Skip to content

Commit

Permalink
Migrated to 1.14.4, fixed keepInventory bug
Browse files Browse the repository at this point in the history
  • Loading branch information
briansemrau committed Jul 24, 2019
1 parent d5f4544 commit fd6a433
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.14.3
yarn_mappings=1.14.3+build.9
loader_version=0.4.8+build.155
minecraft_version=1.14.4
yarn_mappings=1.14.4+build.2
loader_version=0.4.8+build.158

# Mod Properties
mod_version = 1.1.2
mod_version = 1.1.3
maven_group = com.github.briansemrau
archives_base_name = cosmetic-armor-slots

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric
fabric_version=0.3.0+build.183
fabric_version=0.3.0+build.200
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected void init() {
IPlayerEntityMixin player = ((IPlayerEntityMixin) this.playerInventory.player);
this.addButton(new ButtonWidget(this.left + 94, this.top + 12 + i * 18, 8, 8, "", (buttonWidget) -> {
player.setUseCosmeticArmorSlot(slotIndex, !player.getUseCosmeticArmorSlot(slotIndex));
this.minecraft.getNetworkHandler().getClientConnection().send(CosmeticArmorSlotsNetwork.createCosmeticSlotVisibilityUpdatePacket(EquipmentSlot.fromTypeIndex(EquipmentSlot.Type.ARMOR, slotIndex), player.getUseCosmeticArmorSlot(slotIndex)));
this.minecraft.getNetworkHandler().getConnection().send(CosmeticArmorSlotsNetwork.createCosmeticSlotVisibilityUpdatePacket(EquipmentSlot.fromTypeIndex(EquipmentSlot.Type.ARMOR, slotIndex), player.getUseCosmeticArmorSlot(slotIndex)));
}) {
@Override
public void render(int int_1, int int_2, float float_1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public abstract class PlayerEntityMixin extends LivingEntity implements IPlayerE

@Environment(EnvType.SERVER)
@Unique
private final DefaultedList<ItemStack> equippedCosmeticArmor = DefaultedList.create(4, ItemStack.EMPTY);
private final DefaultedList<ItemStack> equippedCosmeticArmor = DefaultedList.ofSize(4, ItemStack.EMPTY);
@Environment(EnvType.SERVER)
@Unique
private final boolean[] storedUsingCosmeticArmorSlot = new boolean[4];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
import net.minecraft.nbt.ListTag;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Nameable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand Down Expand Up @@ -56,7 +53,7 @@ public DefaultedList<ItemStack> getCosmeticArmor() {

@Inject(method = "<init>*", at = @At("RETURN"))
public void onConstructed(PlayerEntity playerEntity, CallbackInfo ci) {
cosmeticArmor = DefaultedList.create(4, ItemStack.EMPTY);
cosmeticArmor = DefaultedList.ofSize(4, ItemStack.EMPTY);

// Change combinedInventory to a mutable type
combinedInventory = new ArrayList<>(combinedInventory);
Expand Down Expand Up @@ -96,8 +93,11 @@ public void onDeserialize(ListTag listTag_1, CallbackInfo ci) {
}
}

// Overwrite
public int getInvSize(CallbackInfo ci) {
/**
* @author brian_flakes
*/
@Overwrite
public int getInvSize() {
int size = 0;
for (DefaultedList list : combinedInventory) {
size += list.size();
Expand Down

0 comments on commit fd6a433

Please sign in to comment.