Skip to content

Commit

Permalink
Update mappings to 1.14.3, fixed server crash
Browse files Browse the repository at this point in the history
  • Loading branch information
briansemrau committed Jun 30, 2019
1 parent 55c865b commit d5f4544
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G

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

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.github.briansemrau.cosmeticarmorslots;

import net.fabricmc.api.ClientModInitializer;

public class CosmeticArmorSlotsClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
CosmeticArmorSlotsNetwork.onInitializeClient();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ public class CosmeticArmorSlotsNetwork {
public static final Identifier VISIBILITY_UPDATE_PACKET = new Identifier(MOD_ID, "visibility_update");

public static void onInitialize() {
ServerSidePacketRegistry.INSTANCE.register(VISIBILITY_UPDATE_PACKET, (packetContext, packetByteBuf) -> {
EquipmentSlot slot = packetByteBuf.readEnumConstant(EquipmentSlot.class);
boolean visible = packetByteBuf.readBoolean();

((IPlayerEntityMixin) packetContext.getPlayer()).setUseCosmeticArmorSlot(slot.getEntitySlotId(), visible);
});
}

public static void onInitializeClient() {
ClientSidePacketRegistry.INSTANCE.register(EQUIP_COSMETIC_ARMOR_PACKET, (packetContext, packetByteBuf) -> {
int entityId = packetByteBuf.readVarInt();
EquipmentSlot slot = packetByteBuf.readEnumConstant(EquipmentSlot.class);
Expand All @@ -32,12 +41,6 @@ public static void onInitialize() {
((IPlayerEntityMixin) player).setUseCosmeticArmorSlot(slot.getEntitySlotId(), useCosmeticSlot);
}
});
ServerSidePacketRegistry.INSTANCE.register(VISIBILITY_UPDATE_PACKET, (packetContext, packetByteBuf) -> {
EquipmentSlot slot = packetByteBuf.readEnumConstant(EquipmentSlot.class);
boolean visible = packetByteBuf.readBoolean();

((IPlayerEntityMixin) packetContext.getPlayer()).setUseCosmeticArmorSlot(slot.getEntitySlotId(), visible);
});
}

public static CustomPayloadS2CPacket createEquipCosmeticArmorPacket(int entityId, EquipmentSlot slot, ItemStack stack, boolean visible) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;

import javax.annotation.Nullable;
Expand All @@ -34,7 +34,7 @@ public class CosmeticArmorInventoryScreen extends AbstractContainerScreen<Cosmet
private float mouseY;

public CosmeticArmorInventoryScreen(PlayerEntity playerEntity) {
super(new CosmeticArmorSlotsContainer(playerEntity.inventory), playerEntity.inventory, new TranslatableComponent("container.cosmeticarmorslots"));
super(new CosmeticArmorSlotsContainer(playerEntity.inventory), playerEntity.inventory, new TranslatableText("container.cosmeticarmorslots"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.container.Slot;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.network.chat.Component;
import net.minecraft.text.Text;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -20,8 +20,8 @@
@Mixin(CreativeInventoryScreen.class)
public abstract class CreativeInventoryScreenMixin extends AbstractInventoryScreen<CreativeInventoryScreen.CreativeContainer> {

public CreativeInventoryScreenMixin(CreativeInventoryScreen.CreativeContainer container_1, PlayerInventory playerInventory_1, Component component_1) {
super(container_1, playerInventory_1, component_1);
public CreativeInventoryScreenMixin(CreativeInventoryScreen.CreativeContainer container_1, PlayerInventory playerInventory_1, Text text_1) {
super(container_1, playerInventory_1, text_1);
}

@Inject(method = "setSelectedTab",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import net.minecraft.client.gui.widget.TexturedButtonWidget;
import net.minecraft.container.PlayerContainer;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.network.chat.Component;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -26,8 +26,8 @@ public abstract class InventoryScreenMixin extends AbstractInventoryScreen<Playe
@Shadow
private boolean isMouseDown;

public InventoryScreenMixin(PlayerContainer container_1, PlayerInventory playerInventory_1, Component component_1) {
super(container_1, playerInventory_1, component_1);
public InventoryScreenMixin(PlayerContainer container_1, PlayerInventory playerInventory_1, Text text_1) {
super(container_1, playerInventory_1, text_1);
}

@Inject(method = "init", at = @At("TAIL"))
Expand Down

0 comments on commit d5f4544

Please sign in to comment.