Tech Reborn

Tech Reborn

30M Downloads

(Basic) Drill doesn't break torches, especially not instantly

Ayutac opened this issue ยท 5 comments

commented

MC 1.18.2
TR 5.2.0-beta.2

Other mods are present, but I doubt they are responsible for this

commented

RebornRegistry.registerItem(TRContent.BASIC_DRILL = InitUtils.setup(new DrillItem(TRToolMaterials.BASIC_DRILL, TechRebornConfig.basicDrillCharge, RcEnergyTier.MEDIUM, TechRebornConfig.basicDrillCost, 6F, -.5F, MiningLevel.IRON), "basic_drill"));

Constructor for reference:

public DrillItem(ToolMaterial material, int energyCapacity, RcEnergyTier tier, int cost, float poweredSpeed, float unpoweredSpeed, MiningLevel miningLevel) {
// combat stats same as for diamond pickaxe. Fix for #2468
super(1, -2.8F, material, DRILL_MINEABLE, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
this.maxCharge = energyCapacity;
this.cost = cost;
this.poweredSpeed = poweredSpeed;
this.unpoweredSpeed = unpoweredSpeed;
this.miningLevel = miningLevel.intLevel;
this.tier = tier;
}

The unpowered breaking speed multiplier is literally NEGATIVE.

And since Torches don't need a tool, the negative mining speed is applied to them.

commented

public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
// Going to remain to use this ol reliable function, the fabric one is funky
if (getStoredEnergy(stack) >= cost) {
if (stack.getItem().isSuitableFor(state)) {
return poweredSpeed;
} else {
return Math.min(unpoweredSpeed * 10f, poweredSpeed); // Still be faster than unpowered when not effective
}
}
return unpoweredSpeed;
}

Special highlight to the Math.min function.
-5 is obviously smaller than 6, so -5 is the mining speed for non-effective blocks.

commented

Still exits in TR 5.3.4 standalone. Holds for torches, soulfire torches, redstone torches. Doesn't for e.g. item frame.

commented

Not just torches
any tree, cactus, dead bush.
can understand trees and cactus but dead bush and torches are insta break no matter what is held

commented

Export of tags applied to tool, no difference between them ๐Ÿคทโ€โ™‚๏ธ

image
image
image