mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-08 19:38:57 +01:00
Random code cleanup again ™️
This commit is contained in:
parent
52d62b0fe1
commit
2a5648fcca
@ -67,7 +67,7 @@ public abstract class MixinItemStack implements IItemStack {
|
||||
if (DebugSettings.global().replaceAttributeModifiers.isEnabled() && !modifiers.isEmpty()) {
|
||||
modifiers = HashMultimap.create(modifiers);
|
||||
modifiers.removeAll(EntityAttributes.GENERIC_ATTACK_DAMAGE);
|
||||
if (getItem() instanceof MiningToolItem tool && !(tool instanceof HoeItem) /* Hoe items didn't use the tool abstraction */) {
|
||||
if (getItem() instanceof MiningToolItem tool && !(tool instanceof HoeItem) /* hoe doesn't use the tool abstraction in 1.8 */) {
|
||||
modifiers.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, new EntityAttributeModifier(Item.ATTACK_DAMAGE_MODIFIER_ID, "Tool modifier", tool.getAttackDamage(), EntityAttributeModifier.Operation.ADDITION));
|
||||
} else if (getItem() instanceof SwordItem sword) {
|
||||
modifiers.put(EntityAttributes.GENERIC_ATTACK_DAMAGE, new EntityAttributeModifier(Item.ATTACK_DAMAGE_MODIFIER_ID, "Weapon modifier", sword.getAttackDamage(), EntityAttributeModifier.Operation.ADDITION));
|
||||
|
@ -37,18 +37,19 @@ public abstract class MixinMiningToolItem extends ToolItem {
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Mojang, FlorianMichael/EnZaXD
|
||||
* @author FlorianMichael/EnZaXD
|
||||
* @reason Change attack damage calculation
|
||||
*/
|
||||
@Overwrite
|
||||
public float getAttackDamage() {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) {
|
||||
final float materialDamage = getMaterial().getAttackDamage();
|
||||
if ((Item) this instanceof PickaxeItem) {
|
||||
return 2 + getMaterial().getAttackDamage();
|
||||
return 2 + materialDamage;
|
||||
} else if ((Item) this instanceof ShovelItem) {
|
||||
return 1 + getMaterial().getAttackDamage();
|
||||
return 1 + materialDamage;
|
||||
} else if ((Item) this instanceof AxeItem) {
|
||||
return 3 + getMaterial().getAttackDamage();
|
||||
return 3 + materialDamage;
|
||||
}
|
||||
}
|
||||
return this.attackDamage;
|
||||
|
@ -77,7 +77,7 @@ public abstract class MixinSwordItem extends ToolItem {
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Mojang, FlorianMichael/EnZaXD
|
||||
* @author FlorianMichael/EnZaXD
|
||||
* @reason Change attack damage calculation
|
||||
*/
|
||||
@Overwrite
|
||||
|
@ -49,7 +49,7 @@ public class ItemTranslator {
|
||||
* Converts a Minecraft item stack to a ViaVersion item stack
|
||||
*
|
||||
* @param stack The Minecraft item stack
|
||||
* @param targetVersion The target version to convert to (e.g. r1.13)
|
||||
* @param targetVersion The target version to convert to (e.g. v1.13)
|
||||
* @return The ViaVersion item stack for the target version
|
||||
*/
|
||||
public static Item mcToVia(final ItemStack stack, final ProtocolVersion targetVersion) {
|
||||
|
Loading…
Reference in New Issue
Block a user