From 065970614db5b8d80968d50f007e088776796b0b Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Fri, 30 Nov 2018 12:52:22 +0100 Subject: [PATCH] clean up, update to 18w48b.2 --- build.gradle | 6 +++--- .../MixinClientPlayNetworkHandler.java | 8 ++++---- .../mixin/resources/MixinMinecraftGame.java | 4 ++-- .../mixin/resources/MixinMinecraftServer.java | 1 - .../fabric/mixin/tools/MixinItemStack.java | 2 +- .../fabric/mixin/tools/MixinMiningToolItem.java | 6 +++--- .../fabric/registry/RegistrySyncManager.java | 16 ++++++++-------- .../resources/ModDirectoryResourcePack.java | 10 ---------- .../fabric/resources/ModZipResourcePack.java | 10 ---------- .../fabric/tools/MiningToolDelegate.java | 2 +- 10 files changed, 22 insertions(+), 43 deletions(-) diff --git a/build.gradle b/build.gradle index c6ffa64d2..481d68c8a 100644 --- a/build.gradle +++ b/build.gradle @@ -30,9 +30,9 @@ minecraft { } dependencies { - minecraft "com.mojang:minecraft:18w47b" - mappings "net.fabricmc:pomf:18w47b.10" - modCompile "net.fabricmc:fabric-loader:18w44a-0.1.0.46" + minecraft "com.mojang:minecraft:18w48b" + mappings "net.fabricmc:pomf:18w48b.2" + modCompile "net.fabricmc:fabric-loader:18w44a-0.1.0.47" } apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/maven.gradle' diff --git a/src/main/java/net/fabricmc/fabric/mixin/networking/MixinClientPlayNetworkHandler.java b/src/main/java/net/fabricmc/fabric/mixin/networking/MixinClientPlayNetworkHandler.java index 97cacdf45..08304b1dd 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/networking/MixinClientPlayNetworkHandler.java +++ b/src/main/java/net/fabricmc/fabric/mixin/networking/MixinClientPlayNetworkHandler.java @@ -20,7 +20,7 @@ import net.fabricmc.api.Side; import net.fabricmc.fabric.networking.CustomPayloadHandlerRegistry; import net.fabricmc.fabric.networking.PacketContext; import net.fabricmc.fabric.networking.SPacketCustomPayloadAccessor; -import net.minecraft.client.MinecraftGame; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.packet.CustomPayloadClientPacket; import net.minecraft.entity.player.PlayerEntity; @@ -35,7 +35,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ClientPlayNetworkHandler.class) public class MixinClientPlayNetworkHandler implements PacketContext { @Shadow - private MinecraftGame game; + private MinecraftClient client; @Inject(method = "onCustomPayload", at = @At("HEAD"), cancellable = true) public void onCustomPayload(CustomPayloadClientPacket packet, CallbackInfo info) { @@ -51,11 +51,11 @@ public class MixinClientPlayNetworkHandler implements PacketContext { @Override public PlayerEntity getPlayer() { - return game.player; + return client.player; } @Override public ThreadTaskQueue getTaskQueue() { - return game; + return client; } } diff --git a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java b/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java index 59c674926..9f4ae310a 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java +++ b/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftGame.java @@ -17,7 +17,7 @@ package net.fabricmc.fabric.mixin.resources; import net.fabricmc.fabric.resources.ModResourcePackUtil; -import net.minecraft.client.MinecraftGame; +import net.minecraft.client.MinecraftClient; import net.minecraft.resource.ReloadableResourceManager; import net.minecraft.resource.ResourcePack; import net.minecraft.resource.ResourceType; @@ -30,7 +30,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.List; -@Mixin(MinecraftGame.class) +@Mixin(MinecraftClient.class) public class MixinMinecraftGame { @Shadow private ReloadableResourceManager resourceManager; diff --git a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java b/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java index ecc7b01e6..8ca836b94 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java +++ b/src/main/java/net/fabricmc/fabric/mixin/resources/MixinMinecraftServer.java @@ -21,7 +21,6 @@ import net.fabricmc.fabric.resources.ModResourcePack; import net.fabricmc.fabric.resources.ModResourcePackUtil; import net.minecraft.class_3283; import net.minecraft.class_3288; -import net.minecraft.client.MinecraftGame; import net.minecraft.resource.ReloadableResourceManager; import net.minecraft.resource.ResourcePack; import net.minecraft.resource.ResourceType; diff --git a/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java b/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java index 61fc4f5ba..25a7a58fb 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java +++ b/src/main/java/net/fabricmc/fabric/mixin/tools/MixinItemStack.java @@ -47,7 +47,7 @@ public abstract class MixinItemStack { if (this.getItem() instanceof MiningToolDelegate) { TriState triState = ToolManager.handleIsEffectiveOn((ItemStack) (Object) this, state); if (triState != TriState.DEFAULT) { - info.setReturnValue(triState.get() ? ((MiningToolDelegate) this.getItem()).getMiningToolEfficiency() : 1.0F); + info.setReturnValue(triState.get() ? ((MiningToolDelegate) this.getItem()).getBlockBreakingSpeed() : 1.0F); info.cancel(); } } diff --git a/src/main/java/net/fabricmc/fabric/mixin/tools/MixinMiningToolItem.java b/src/main/java/net/fabricmc/fabric/mixin/tools/MixinMiningToolItem.java index a4f85dbe9..523231aae 100644 --- a/src/main/java/net/fabricmc/fabric/mixin/tools/MixinMiningToolItem.java +++ b/src/main/java/net/fabricmc/fabric/mixin/tools/MixinMiningToolItem.java @@ -24,10 +24,10 @@ import org.spongepowered.asm.mixin.Shadow; @Mixin(MiningToolItem.class) public class MixinMiningToolItem implements MiningToolDelegate { @Shadow - protected float efficiency; + protected float blockBreakingSpeed; @Override - public float getMiningToolEfficiency() { - return efficiency; + public float getBlockBreakingSpeed() { + return blockBreakingSpeed; } } diff --git a/src/main/java/net/fabricmc/fabric/registry/RegistrySyncManager.java b/src/main/java/net/fabricmc/fabric/registry/RegistrySyncManager.java index d4924c63e..18e63dab6 100644 --- a/src/main/java/net/fabricmc/fabric/registry/RegistrySyncManager.java +++ b/src/main/java/net/fabricmc/fabric/registry/RegistrySyncManager.java @@ -45,14 +45,14 @@ public final class RegistrySyncManager { public static CustomPayloadClientPacket createPacket() { PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer()); - buf.writeTagCompound(toTag(true)); + buf.writeCompoundTag(toTag(true)); CustomPayloadClientPacket packet = new CustomPayloadClientPacket(ID, buf); return packet; } public static void receivePacket(PacketContext context, PacketByteBuf buf) { - CompoundTag compound = buf.readTagCompound(); + CompoundTag compound = buf.readCompoundTag(); try { apply(compound, false); @@ -77,28 +77,28 @@ public final class RegistrySyncManager { CompoundTag registryTag = new CompoundTag(); //noinspection unchecked for (Identifier identifier : (Set) registry.keys()) { - registryTag.setInt(identifier.toString(), registry.getRawId(registry.get(identifier))); + registryTag.putInt(identifier.toString(), registry.getRawId(registry.get(identifier))); } - mainTag.setTag(registryId.toString(), registryTag); + mainTag.put(registryId.toString(), registryTag); } } CompoundTag tag = new CompoundTag(); - tag.setInt("version", 1); - tag.setTag("registries", mainTag); + tag.putInt("version", 1); + tag.put("registries", mainTag); return tag; } public static void apply(CompoundTag tag, boolean reallocateMissingEntries) throws RemapException { - CompoundTag mainTag = tag.getTagCompound("registries"); + CompoundTag mainTag = tag.getCompound("registries"); for (Identifier registryId : Registry.REGISTRIES.keys()) { if (!mainTag.containsKey(registryId.toString())) { continue; } - CompoundTag registryTag = mainTag.getTagCompound(registryId.toString()); + CompoundTag registryTag = mainTag.getCompound(registryId.toString()); ModifiableRegistry registry = Registry.REGISTRIES.get(registryId); if (registry instanceof IdRegistry && registry instanceof RemappableRegistry) { Object2IntMap idMap = new Object2IntOpenHashMap<>(); diff --git a/src/main/java/net/fabricmc/fabric/resources/ModDirectoryResourcePack.java b/src/main/java/net/fabricmc/fabric/resources/ModDirectoryResourcePack.java index 86a0e4d49..e3d1ad570 100644 --- a/src/main/java/net/fabricmc/fabric/resources/ModDirectoryResourcePack.java +++ b/src/main/java/net/fabricmc/fabric/resources/ModDirectoryResourcePack.java @@ -52,16 +52,6 @@ public class ModDirectoryResourcePack extends DirectoryResourcePack implements M } } - @Override - public Collection findResources(ResourceType var1, String var2, int var3, Predicate var4) { - System.out.println("called " + var1 + " " + var2 + " " + var3); - Collection test = super.findResources(var1, var2, var3, var4); - for (Identifier id : test) { - System.out.println("- " + id); - } - return test; - } - @Override protected boolean containsFilename(String filename) { return super.containsFilename(filename) || ModResourcePackUtil.containsDefault(info, filename); diff --git a/src/main/java/net/fabricmc/fabric/resources/ModZipResourcePack.java b/src/main/java/net/fabricmc/fabric/resources/ModZipResourcePack.java index 3f2f49dcc..816d2fb27 100644 --- a/src/main/java/net/fabricmc/fabric/resources/ModZipResourcePack.java +++ b/src/main/java/net/fabricmc/fabric/resources/ModZipResourcePack.java @@ -55,16 +55,6 @@ public class ModZipResourcePack extends ZipResourcePack implements ModResourcePa } } - @Override - public Collection findResources(ResourceType var1, String var2, int var3, Predicate var4) { - System.out.println("called " + var1 + " " + var2 + " " + var3); - Collection test = super.findResources(var1, var2, var3, var4); - for (Identifier id : test) { - System.out.println("- " + id); - } - return test; - } - @Override public boolean containsFilename(String filename) { return super.containsFilename(filename) || ModResourcePackUtil.containsDefault(info, filename); diff --git a/src/main/java/net/fabricmc/fabric/tools/MiningToolDelegate.java b/src/main/java/net/fabricmc/fabric/tools/MiningToolDelegate.java index 96067cf3d..845a55878 100644 --- a/src/main/java/net/fabricmc/fabric/tools/MiningToolDelegate.java +++ b/src/main/java/net/fabricmc/fabric/tools/MiningToolDelegate.java @@ -17,5 +17,5 @@ package net.fabricmc.fabric.tools; public interface MiningToolDelegate { - float getMiningToolEfficiency(); + float getBlockBreakingSpeed(); }