Rebalance drill speed and mining level
This commit is contained in:
parent
481634d29f
commit
a1e3df3c4a
5 changed files with 37 additions and 32 deletions
|
@ -183,12 +183,12 @@ public class ModRegistry {
|
||||||
RebornRegistry.registerItem(TRContent.WRENCH = InitUtils.setup(new WrenchItem(), "wrench"));
|
RebornRegistry.registerItem(TRContent.WRENCH = InitUtils.setup(new WrenchItem(), "wrench"));
|
||||||
RebornRegistry.registerItem(TRContent.PAINTING_TOOL = InitUtils.setup(new PaintingToolItem(), "painting_tool"));
|
RebornRegistry.registerItem(TRContent.PAINTING_TOOL = InitUtils.setup(new PaintingToolItem(), "painting_tool"));
|
||||||
|
|
||||||
RebornRegistry.registerItem(TRContent.BASIC_DRILL = InitUtils.setup(new DrillItem(ToolMaterials.IRON, TechRebornConfig.basicDrillCharge, EnergyTier.MEDIUM, TechRebornConfig.basicDrillCost, 10F, 0.5F, Items.IRON_PICKAXE, Items.IRON_SHOVEL), "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), "basic_jackhammer"));
|
RebornRegistry.registerItem(TRContent.BASIC_JACKHAMMER = InitUtils.setup(new JackhammerItem(ToolMaterials.DIAMOND, 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, 1.0F, Items.DIAMOND_PICKAXE, Items.DIAMOND_SHOVEL), "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"));
|
||||||
RebornRegistry.registerItem(TRContent.ADVANCED_CHAINSAW = InitUtils.setup(new ChainsawItem(ToolMaterials.DIAMOND, TechRebornConfig.advancedChainsawCharge, EnergyTier.EXTREME, TechRebornConfig.advancedChainsawCost, 20F, 1.0F, Items.DIAMOND_AXE), "advanced_chainsaw"));
|
RebornRegistry.registerItem(TRContent.ADVANCED_CHAINSAW = InitUtils.setup(new ChainsawItem(ToolMaterials.DIAMOND, TechRebornConfig.advancedChainsawCharge, EnergyTier.EXTREME, TechRebornConfig.advancedChainsawCost, 20F, 1.0F, Items.DIAMOND_AXE), "advanced_chainsaw"));
|
||||||
RebornRegistry.registerItem(TRContent.ADVANCED_JACKHAMMER = InitUtils.setup(new AdvancedJackhammerItem(), "advanced_jackhammer"));
|
RebornRegistry.registerItem(TRContent.ADVANCED_JACKHAMMER = InitUtils.setup(new AdvancedJackhammerItem(), "advanced_jackhammer"));
|
||||||
RebornRegistry.registerItem(TRContent.ROCK_CUTTER = InitUtils.setup(new RockCutterItem(), "rock_cutter"));
|
RebornRegistry.registerItem(TRContent.ROCK_CUTTER = InitUtils.setup(new RockCutterItem(), "rock_cutter"));
|
||||||
|
|
|
@ -78,6 +78,7 @@ import techreborn.entities.EntityNukePrimed;
|
||||||
import techreborn.items.DynamicCellItem;
|
import techreborn.items.DynamicCellItem;
|
||||||
import techreborn.items.UpgradeItem;
|
import techreborn.items.UpgradeItem;
|
||||||
import techreborn.items.armor.QuantumSuitItem;
|
import techreborn.items.armor.QuantumSuitItem;
|
||||||
|
import techreborn.items.tool.MiningLevel;
|
||||||
import techreborn.utils.InitUtils;
|
import techreborn.utils.InitUtils;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
@ -413,19 +414,6 @@ public class TRContent {
|
||||||
return block.asItem();
|
return block.asItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just a holder for the mining levels
|
|
||||||
private enum MiningLevel {
|
|
||||||
WOOD(0),
|
|
||||||
STONE(1),
|
|
||||||
IRON(2),
|
|
||||||
DIAMOND(3);
|
|
||||||
|
|
||||||
final int intLevel;
|
|
||||||
|
|
||||||
MiningLevel(int intLevel) {
|
|
||||||
this.intLevel = intLevel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum StorageBlocks implements ItemConvertible {
|
public enum StorageBlocks implements ItemConvertible {
|
||||||
|
|
|
@ -25,11 +25,13 @@
|
||||||
package techreborn.items.tool;
|
package techreborn.items.tool;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.DynamicAttributeTool;
|
import net.fabricmc.fabric.api.tool.attribute.v1.DynamicAttributeTool;
|
||||||
|
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.enchantment.Enchantments;
|
import net.minecraft.enchantment.Enchantments;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.*;
|
import net.minecraft.item.*;
|
||||||
|
import net.minecraft.tag.Tag;
|
||||||
import net.minecraft.util.collection.DefaultedList;
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -48,31 +50,28 @@ public class DrillItem extends PickaxeItem implements EnergyHolder, ItemDurabili
|
||||||
public final int maxCharge;
|
public final int maxCharge;
|
||||||
public final int cost;
|
public final int cost;
|
||||||
public final float poweredSpeed;
|
public final float poweredSpeed;
|
||||||
public final Item referencePickaxe;
|
public final float unpoweredSpeed;
|
||||||
public final Item referenceShovel;
|
public final int miningLevel;
|
||||||
public final EnergyTier tier;
|
public final EnergyTier tier;
|
||||||
|
|
||||||
public DrillItem(ToolMaterials material, int energyCapacity, EnergyTier tier, int cost, float poweredSpeed, float unpoweredSpeed, Item referencePickaxe, Item referenceShovel) {
|
public DrillItem(ToolMaterials material, int energyCapacity, EnergyTier tier, int cost, float poweredSpeed, float unpoweredSpeed, MiningLevel miningLevel) {
|
||||||
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
super(material, (int) material.getAttackDamage(), unpoweredSpeed, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||||
this.maxCharge = energyCapacity;
|
this.maxCharge = energyCapacity;
|
||||||
this.cost = cost;
|
this.cost = cost;
|
||||||
this.poweredSpeed = poweredSpeed;
|
this.poweredSpeed = poweredSpeed;
|
||||||
this.referencePickaxe = referencePickaxe;
|
this.unpoweredSpeed = unpoweredSpeed;
|
||||||
this.referenceShovel = referenceShovel;
|
this.miningLevel = miningLevel.intLevel;
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PickaxeItem
|
|
||||||
@Override
|
@Override
|
||||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
public float getMiningSpeedMultiplier(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
|
||||||
if (Energy.of(stack).getEnergy() < cost) {
|
if (tag.equals(FabricToolTags.PICKAXES) && stack.getItem().isEffectiveOn(state)) {
|
||||||
return -0.8F;
|
if (Energy.of(stack).getEnergy() >= cost) {
|
||||||
|
return poweredSpeed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Items.WOODEN_PICKAXE.getMiningSpeedMultiplier(stack, state) > 1.0F
|
return 0;
|
||||||
|| Items.WOODEN_SHOVEL.getMiningSpeedMultiplier(stack, state) > 1.0F) {
|
|
||||||
return poweredSpeed;
|
|
||||||
}
|
|
||||||
return super.getMiningSpeedMultiplier(stack, state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MiningToolItem
|
// MiningToolItem
|
||||||
|
@ -115,8 +114,11 @@ public class DrillItem extends PickaxeItem implements EnergyHolder, ItemDurabili
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEffectiveOn(BlockState state) {
|
public int getMiningLevel(Tag<Item> tag, BlockState state, ItemStack stack, LivingEntity user) {
|
||||||
return referencePickaxe.isEffectiveOn(state) || referenceShovel.isEffectiveOn(state);
|
if (tag.equals(FabricToolTags.PICKAXES)) {
|
||||||
|
return miningLevel;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ItemDurabilityExtensions
|
// ItemDurabilityExtensions
|
||||||
|
|
14
src/main/java/techreborn/items/tool/MiningLevel.java
Normal file
14
src/main/java/techreborn/items/tool/MiningLevel.java
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
package techreborn.items.tool;
|
||||||
|
|
||||||
|
public enum MiningLevel {
|
||||||
|
WOOD(0),
|
||||||
|
STONE(1),
|
||||||
|
IRON(2),
|
||||||
|
DIAMOND(3);
|
||||||
|
|
||||||
|
public final int intLevel;
|
||||||
|
|
||||||
|
MiningLevel(int intLevel) {
|
||||||
|
this.intLevel = intLevel;
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,6 +47,7 @@ import team.reborn.energy.EnergyTier;
|
||||||
import techreborn.config.TechRebornConfig;
|
import techreborn.config.TechRebornConfig;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
import techreborn.items.tool.DrillItem;
|
import techreborn.items.tool.DrillItem;
|
||||||
|
import techreborn.items.tool.MiningLevel;
|
||||||
import techreborn.utils.InitUtils;
|
import techreborn.utils.InitUtils;
|
||||||
import techreborn.utils.MessageIDs;
|
import techreborn.utils.MessageIDs;
|
||||||
import techreborn.utils.ToolsUtil;
|
import techreborn.utils.ToolsUtil;
|
||||||
|
@ -57,7 +58,7 @@ import java.util.List;
|
||||||
public class IndustrialDrillItem extends DrillItem {
|
public class IndustrialDrillItem extends DrillItem {
|
||||||
|
|
||||||
public IndustrialDrillItem() {
|
public IndustrialDrillItem() {
|
||||||
super(ToolMaterials.DIAMOND, TechRebornConfig.industrialDrillCharge, EnergyTier.INSANE, TechRebornConfig.industrialDrillCost, 15.0F, 2.0F, Items.DIAMOND_PICKAXE, Items.DIAMOND_SHOVEL);
|
super(ToolMaterials.DIAMOND, TechRebornConfig.industrialDrillCharge, EnergyTier.INSANE, TechRebornConfig.industrialDrillCost, 20.0F, 1.0F, MiningLevel.DIAMOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldBreak(PlayerEntity playerIn, World worldIn, BlockPos originalPos, BlockPos pos) {
|
private boolean shouldBreak(PlayerEntity playerIn, World worldIn, BlockPos originalPos, BlockPos pos) {
|
||||||
|
|
Loading…
Reference in a new issue