mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-21 11:46:49 +01:00
Fixed namings in MixinItemStack and updated Classic4J
This commit is contained in:
parent
549fce8b55
commit
610ae09d69
@ -32,4 +32,4 @@ mcping_version=1.4.0
|
||||
|
||||
# Misc Libraries
|
||||
mod_menu_version=9.0.0
|
||||
classic4j_version=2.0.1
|
||||
classic4j_version=2.0.2
|
||||
|
@ -21,7 +21,7 @@ package de.florianmichael.viafabricplus.injection.access;
|
||||
|
||||
public interface IItemStack {
|
||||
|
||||
boolean viaFabricPlus$has1_10ViaFabricPlusTag();
|
||||
boolean viaFabricPlus$has1_10Tag();
|
||||
|
||||
int viaFabricPlus$get1_10Count();
|
||||
|
||||
|
@ -31,7 +31,7 @@ public abstract class MixinDrawContext {
|
||||
|
||||
@Redirect(method = "drawItemInSlot(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getCount()I"))
|
||||
private int handleNegativeItemCount(ItemStack instance) {
|
||||
if (((IItemStack) (Object) instance).viaFabricPlus$has1_10ViaFabricPlusTag()) {
|
||||
if (((IItemStack) (Object) instance).viaFabricPlus$has1_10Tag()) {
|
||||
return ((IItemStack) (Object) instance).viaFabricPlus$get1_10Count();
|
||||
}
|
||||
return instance.getCount();
|
||||
|
@ -45,10 +45,10 @@ public abstract class MixinItemStack implements IItemStack {
|
||||
public abstract Item getItem();
|
||||
|
||||
@Unique
|
||||
private boolean viaFabricPlus$has1_10ProtocolHackTag;
|
||||
private boolean viaFabricPlus$has1_10Tag;
|
||||
|
||||
@Unique
|
||||
private int viaFabricPlus$1_10_count;
|
||||
private int viaFabricPlus$1_10Count;
|
||||
|
||||
@Redirect(method = "getTooltip",
|
||||
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/entity/attribute/EntityAttributes;GENERIC_ATTACK_DAMAGE:Lnet/minecraft/entity/attribute/EntityAttribute;", ordinal = 0)),
|
||||
@ -64,7 +64,9 @@ public abstract class MixinItemStack implements IItemStack {
|
||||
@SuppressWarnings({"InvalidInjectorMethodSignature", "MixinAnnotationTarget"})
|
||||
@ModifyVariable(method = "getAttributeModifiers", ordinal = 0, at = @At(value = "STORE", ordinal = 1))
|
||||
private Multimap<EntityAttribute, EntityAttributeModifier> modifyVariableGetAttributeModifiers(Multimap<EntityAttribute, EntityAttributeModifier> modifiers) {
|
||||
if (!DebugSettings.global().replaceAttributeModifiers.isEnabled() || modifiers.isEmpty()) return modifiers;
|
||||
if (!DebugSettings.global().replaceAttributeModifiers.isEnabled() || modifiers.isEmpty()) {
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
modifiers = HashMultimap.create(modifiers);
|
||||
modifiers.removeAll(EntityAttributes.GENERIC_ATTACK_DAMAGE);
|
||||
@ -79,10 +81,10 @@ public abstract class MixinItemStack implements IItemStack {
|
||||
}
|
||||
|
||||
@Inject(method = "copy", at = @At("RETURN"))
|
||||
private void copyProtocolHackData(CallbackInfoReturnable<ItemStack> cir) {
|
||||
private void copyViaFabricPlusData(CallbackInfoReturnable<ItemStack> cir) {
|
||||
final IItemStack mixinItemStack = (IItemStack) (Object) cir.getReturnValue();
|
||||
if (this.viaFabricPlus$has1_10ProtocolHackTag) {
|
||||
mixinItemStack.viaFabricPlus$set1_10Count(this.viaFabricPlus$1_10_count);
|
||||
if (this.viaFabricPlus$has1_10Tag) {
|
||||
mixinItemStack.viaFabricPlus$set1_10Count(this.viaFabricPlus$1_10Count);
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,19 +107,19 @@ public abstract class MixinItemStack implements IItemStack {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean viaFabricPlus$has1_10ViaFabricPlusTag() {
|
||||
return this.viaFabricPlus$has1_10ProtocolHackTag;
|
||||
public boolean viaFabricPlus$has1_10Tag() {
|
||||
return this.viaFabricPlus$has1_10Tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int viaFabricPlus$get1_10Count() {
|
||||
return this.viaFabricPlus$1_10_count;
|
||||
return this.viaFabricPlus$1_10Count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void viaFabricPlus$set1_10Count(final int count) {
|
||||
this.viaFabricPlus$has1_10ProtocolHackTag = true;
|
||||
this.viaFabricPlus$1_10_count = count;
|
||||
this.viaFabricPlus$has1_10Tag = true;
|
||||
this.viaFabricPlus$1_10Count = count;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public abstract class MixinPacketByteBuf {
|
||||
NbtCompound tag = instance.getNbt();
|
||||
|
||||
final IItemStack mixinItemStack = ((IItemStack) (Object) instance);
|
||||
if (mixinItemStack.viaFabricPlus$has1_10ViaFabricPlusTag()) {
|
||||
if (mixinItemStack.viaFabricPlus$has1_10Tag()) {
|
||||
if (tag == null) tag = new NbtCompound();
|
||||
tag.putByte(ClientsideFixes.ITEM_COUNT_NBT_TAG, (byte) mixinItemStack.viaFabricPlus$get1_10Count());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user