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_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_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.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"));
|
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 team.reborn.energy.EnergyTier;
|
||||||
import techreborn.TechReborn;
|
import techreborn.TechReborn;
|
||||||
import techreborn.utils.InitUtils;
|
import techreborn.utils.InitUtils;
|
||||||
|
import techreborn.utils.ToolsUtil;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions, DynamicAttributeTool {
|
public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDurabilityExtensions, DynamicAttributeTool {
|
||||||
|
|
||||||
public final int maxCharge;
|
public final int maxCharge;
|
||||||
public final int cost;
|
|
||||||
public final EnergyTier tier;
|
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) {
|
public JackhammerItem(int energyCapacity, EnergyTier tier, int cost) {
|
||||||
super(material, (int) material.getAttackDamage(), 1F, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
super(ToolMaterials.DIAMOND, (int) ToolMaterials.DIAMOND.getAttackDamage(), 1F, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||||
this.maxCharge = energyCapacity;
|
this.maxCharge = energyCapacity;
|
||||||
this.cost = cost;
|
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
this.miningLevel = miningLevel;
|
this.cost = cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PickaxeItem
|
// PickaxeItem
|
||||||
@Override
|
@Override
|
||||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
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;
|
return miningSpeed;
|
||||||
} else {
|
} else {
|
||||||
return 0.5F;
|
return unpoweredSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,13 +88,6 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur
|
||||||
return 0.5F;
|
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
|
// MiningToolItem
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,11 +111,6 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item
|
// Item
|
||||||
@Override
|
|
||||||
public boolean isDamageable() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnchantable(ItemStack stack) {
|
public boolean isEnchantable(ItemStack stack) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -133,6 +124,22 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur
|
||||||
InitUtils.initPoweredItems(this, stacks);
|
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
|
// ItemDurabilityExtensions
|
||||||
@Override
|
@Override
|
||||||
public double getDurability(ItemStack stack) {
|
public double getDurability(ItemStack stack) {
|
||||||
|
@ -149,19 +156,12 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur
|
||||||
return PowerSystem.getDisplayPower().colour;
|
return PowerSystem.getDisplayPower().colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
// EnergyHolder
|
// DynamicAttributeTool
|
||||||
@Override
|
@Override
|
||||||
public double getMaxStoredPower() {
|
public int getMiningLevel(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
|
||||||
return maxCharge;
|
if (tag.equals(FabricToolTags.PICKAXES)) {
|
||||||
}
|
return MiningLevel.IRON.intLevel;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public EnergyTier getTier() {
|
|
||||||
return tier;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput(EnergySide side) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ToolMaterials;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
@ -45,7 +44,6 @@ import reborncore.common.util.ItemUtils;
|
||||||
import team.reborn.energy.EnergyTier;
|
import team.reborn.energy.EnergyTier;
|
||||||
import techreborn.config.TechRebornConfig;
|
import techreborn.config.TechRebornConfig;
|
||||||
import techreborn.items.tool.JackhammerItem;
|
import techreborn.items.tool.JackhammerItem;
|
||||||
import techreborn.items.tool.MiningLevel;
|
|
||||||
import techreborn.utils.MessageIDs;
|
import techreborn.utils.MessageIDs;
|
||||||
import techreborn.utils.ToolsUtil;
|
import techreborn.utils.ToolsUtil;
|
||||||
|
|
||||||
|
@ -57,7 +55,7 @@ import java.util.stream.Collectors;
|
||||||
public class AdvancedJackhammerItem extends JackhammerItem implements MultiBlockBreakingTool {
|
public class AdvancedJackhammerItem extends JackhammerItem implements MultiBlockBreakingTool {
|
||||||
|
|
||||||
public AdvancedJackhammerItem() {
|
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) {
|
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.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Material;
|
|
||||||
import net.minecraft.client.item.TooltipContext;
|
import net.minecraft.client.item.TooltipContext;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ToolMaterials;
|
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.text.TranslatableText;
|
import net.minecraft.text.TranslatableText;
|
||||||
|
@ -43,18 +41,16 @@ import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.TypedActionResult;
|
import net.minecraft.util.TypedActionResult;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import reborncore.common.misc.MultiBlockBreakingTool;
|
import reborncore.common.misc.MultiBlockBreakingTool;
|
||||||
import reborncore.common.util.ChatUtils;
|
import reborncore.common.util.ChatUtils;
|
||||||
import reborncore.common.util.ItemUtils;
|
import reborncore.common.util.ItemUtils;
|
||||||
import team.reborn.energy.Energy;
|
|
||||||
import team.reborn.energy.EnergyTier;
|
import team.reborn.energy.EnergyTier;
|
||||||
import techreborn.config.TechRebornConfig;
|
import techreborn.config.TechRebornConfig;
|
||||||
import techreborn.items.tool.JackhammerItem;
|
import techreborn.items.tool.JackhammerItem;
|
||||||
import techreborn.items.tool.MiningLevel;
|
|
||||||
import techreborn.utils.MessageIDs;
|
import techreborn.utils.MessageIDs;
|
||||||
import techreborn.utils.ToolsUtil;
|
import techreborn.utils.ToolsUtil;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -63,7 +59,7 @@ import java.util.stream.Collectors;
|
||||||
public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlockBreakingTool {
|
public class IndustrialJackhammerItem extends JackhammerItem implements MultiBlockBreakingTool {
|
||||||
|
|
||||||
public IndustrialJackhammerItem() {
|
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
|
// 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);
|
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
|
@Override
|
||||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||||
if (state.getMaterial() == Material.STONE && Energy.of(stack).getEnergy() >= cost) {
|
float speed = super.getMiningSpeedMultiplier(stack, state);
|
||||||
// x4 diamond mining speed
|
|
||||||
return 32.0F;
|
if (speed > unpoweredSpeed) {
|
||||||
} else {
|
return miningSpeed * 4;
|
||||||
return 0.5F;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item
|
// 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