Nerf Jackhammer speed on ores. Closes #2246
This commit is contained in:
parent
2407286b58
commit
0c6513b252
4 changed files with 55 additions and 60 deletions
|
@ -182,7 +182,7 @@ public class ModRegistry {
|
|||
|
||||
RebornRegistry.registerItem(TRContent.BASIC_DRILL = InitUtils.setup(new DrillItem(ToolMaterials.IRON, TechRebornConfig.basicDrillCharge, EnergyTier.MEDIUM, TechRebornConfig.basicDrillCost, 6F, -.5F, MiningLevel.IRON), "basic_drill"));
|
||||
RebornRegistry.registerItem(TRContent.BASIC_CHAINSAW = InitUtils.setup(new ChainsawItem(ToolMaterials.IRON, TechRebornConfig.basicChainsawCharge, EnergyTier.MEDIUM, TechRebornConfig.basicChainsawCost, 20F, 0.5F, Items.IRON_AXE), "basic_chainsaw"));
|
||||
RebornRegistry.registerItem(TRContent.BASIC_JACKHAMMER = InitUtils.setup(new JackhammerItem(ToolMaterials.DIAMOND, TechRebornConfig.basicJackhammerCharge, EnergyTier.MEDIUM, TechRebornConfig.basicJackhammerCost, MiningLevel.IRON), "basic_jackhammer"));
|
||||
RebornRegistry.registerItem(TRContent.BASIC_JACKHAMMER = InitUtils.setup(new JackhammerItem(TechRebornConfig.basicJackhammerCharge, EnergyTier.MEDIUM, TechRebornConfig.basicJackhammerCost), "basic_jackhammer"));
|
||||
RebornRegistry.registerItem(TRContent.ELECTRIC_TREE_TAP = InitUtils.setup(new ElectricTreetapItem(), "electric_treetap"));
|
||||
|
||||
RebornRegistry.registerItem(TRContent.ADVANCED_DRILL = InitUtils.setup(new DrillItem(ToolMaterials.DIAMOND, TechRebornConfig.advancedDrillCharge, EnergyTier.EXTREME, TechRebornConfig.advancedDrillCost, 12F, 0.2F, MiningLevel.DIAMOND), "advanced_drill"));
|
||||
|
|
|
@ -45,31 +45,34 @@ import team.reborn.energy.EnergySide;
|
|||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.utils.InitUtils;
|
||||
import techreborn.utils.ToolsUtil;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions, DynamicAttributeTool {
|
||||
|
||||
public final int maxCharge;
|
||||
public final int cost;
|
||||
public final EnergyTier tier;
|
||||
public final MiningLevel miningLevel;
|
||||
public final int cost;
|
||||
protected final float unpoweredSpeed = 0.5F;
|
||||
|
||||
public JackhammerItem(ToolMaterials material, int energyCapacity, EnergyTier tier, int cost, MiningLevel miningLevel) {
|
||||
super(material, (int) material.getAttackDamage(), 1F, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
public JackhammerItem(int energyCapacity, EnergyTier tier, int cost) {
|
||||
super(ToolMaterials.DIAMOND, (int) ToolMaterials.DIAMOND.getAttackDamage(), 1F, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
this.maxCharge = energyCapacity;
|
||||
this.cost = cost;
|
||||
this.tier = tier;
|
||||
this.miningLevel = miningLevel;
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
// PickaxeItem
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||
if (state.getMaterial() == Material.STONE && Energy.of(stack).getEnergy() >= cost) {
|
||||
if (Energy.of(stack).getEnergy() < cost) return unpoweredSpeed;
|
||||
if (ToolsUtil.JackHammerSkippedBlocks(state)) return unpoweredSpeed;
|
||||
|
||||
if (state.getMaterial() == Material.STONE) {
|
||||
return miningSpeed;
|
||||
} else {
|
||||
return 0.5F;
|
||||
return unpoweredSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,13 +88,6 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur
|
|||
return 0.5F;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public int getMiningLevel(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
|
||||
if (tag.equals(FabricToolTags.PICKAXES)) {
|
||||
return miningLevel.intLevel;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// MiningToolItem
|
||||
@Override
|
||||
|
@ -115,11 +111,6 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur
|
|||
}
|
||||
|
||||
// Item
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnchantable(ItemStack stack) {
|
||||
return true;
|
||||
|
@ -133,6 +124,22 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur
|
|||
InitUtils.initPoweredItems(this, stacks);
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
@Override
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnergyTier getTier() {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
@Override
|
||||
public double getDurability(ItemStack stack) {
|
||||
|
@ -149,19 +156,12 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur
|
|||
return PowerSystem.getDisplayPower().colour;
|
||||
}
|
||||
|
||||
// EnergyHolder
|
||||
// DynamicAttributeTool
|
||||
@Override
|
||||
public double getMaxStoredPower() {
|
||||
return maxCharge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnergyTier getTier() {
|
||||
return tier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxOutput(EnergySide side) {
|
||||
public int getMiningLevel(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
|
||||
if (tag.equals(FabricToolTags.PICKAXES)) {
|
||||
return MiningLevel.IRON.intLevel;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ToolMaterials;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
|
@ -45,7 +44,6 @@ import reborncore.common.util.ItemUtils;
|
|||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.items.tool.JackhammerItem;
|
||||
import techreborn.items.tool.MiningLevel;
|
||||
import techreborn.utils.MessageIDs;
|
||||
import techreborn.utils.ToolsUtil;
|
||||
|
||||
|
@ -57,7 +55,7 @@ import java.util.stream.Collectors;
|
|||
public class AdvancedJackhammerItem extends JackhammerItem implements MultiBlockBreakingTool {
|
||||
|
||||
public AdvancedJackhammerItem() {
|
||||
super(ToolMaterials.DIAMOND, TechRebornConfig.advancedJackhammerCharge, EnergyTier.EXTREME, TechRebornConfig.advancedJackhammerCost, MiningLevel.DIAMOND);
|
||||
super(TechRebornConfig.advancedJackhammerCharge, EnergyTier.EXTREME, TechRebornConfig.advancedJackhammerCost);
|
||||
}
|
||||
|
||||
private boolean shouldBreak(World worldIn, BlockPos originalPos, BlockPos pos, ItemStack stack) {
|
||||
|
|
|
@ -27,13 +27,11 @@ package techreborn.items.tool.industrial;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ToolMaterials;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
|
@ -43,18 +41,16 @@ import net.minecraft.util.Hand;
|
|||
import net.minecraft.util.TypedActionResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.common.misc.MultiBlockBreakingTool;
|
||||
import reborncore.common.util.ChatUtils;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import team.reborn.energy.Energy;
|
||||
import team.reborn.energy.EnergyTier;
|
||||
import techreborn.config.TechRebornConfig;
|
||||
import techreborn.items.tool.JackhammerItem;
|
||||
import techreborn.items.tool.MiningLevel;
|
||||
import techreborn.utils.MessageIDs;
|
||||
import techreborn.utils.ToolsUtil;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -63,7 +59,7 @@ import java.util.stream.Collectors;
|
|||
public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlockBreakingTool {
|
||||
|
||||
public IndustrialJackhammerItem() {
|
||||
super(ToolMaterials.DIAMOND, TechRebornConfig.industrialJackhammerCharge, EnergyTier.INSANE, TechRebornConfig.industrialJackhammerCost, MiningLevel.DIAMOND);
|
||||
super(TechRebornConfig.industrialJackhammerCharge, EnergyTier.INSANE, TechRebornConfig.industrialJackhammerCost);
|
||||
}
|
||||
|
||||
// Cycle Inactive, Active 3*3 and Active 5*5
|
||||
|
@ -121,27 +117,15 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
|
|||
return super.postMine(stack, worldIn, stateIn, pos, entityLiving);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<BlockPos> getBlocksToBreak(ItemStack stack, World worldIn, BlockPos pos, @Nullable LivingEntity entityLiving) {
|
||||
if (!stack.getItem().isEffectiveOn(worldIn.getBlockState(pos))) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
int radius = isAOE5(stack) ? 2 : 1;
|
||||
return ToolsUtil.getAOEMiningBlocks(worldIn, pos, entityLiving, radius, false)
|
||||
.stream()
|
||||
.filter((blockPos -> shouldBreak(worldIn, pos, blockPos, stack)))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
// PickaxeItem
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||
if (state.getMaterial() == Material.STONE && Energy.of(stack).getEnergy() >= cost) {
|
||||
// x4 diamond mining speed
|
||||
return 32.0F;
|
||||
} else {
|
||||
return 0.5F;
|
||||
float speed = super.getMiningSpeedMultiplier(stack, state);
|
||||
|
||||
if (speed > unpoweredSpeed) {
|
||||
return miningSpeed * 4;
|
||||
}
|
||||
|
||||
return speed;
|
||||
}
|
||||
|
||||
// Item
|
||||
|
@ -172,4 +156,17 @@ public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlo
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MultiBlockBreakingTool
|
||||
@Override
|
||||
public Set<BlockPos> getBlocksToBreak(ItemStack stack, World worldIn, BlockPos pos, @Nullable LivingEntity entityLiving) {
|
||||
if (!stack.getItem().isEffectiveOn(worldIn.getBlockState(pos))) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
int radius = isAOE5(stack) ? 2 : 1;
|
||||
return ToolsUtil.getAOEMiningBlocks(worldIn, pos, entityLiving, radius, false)
|
||||
.stream()
|
||||
.filter((blockPos -> shouldBreak(worldIn, pos, blockPos, stack)))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue