clean up, update to 18w48b.2

This commit is contained in:
Adrian Siekierka 2018-11-30 12:52:22 +01:00
parent baccad6a95
commit 065970614d
10 changed files with 22 additions and 43 deletions

View file

@ -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'

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -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<Identifier>) 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<Identifier> idMap = new Object2IntOpenHashMap<>();

View file

@ -52,16 +52,6 @@ public class ModDirectoryResourcePack extends DirectoryResourcePack implements M
}
}
@Override
public Collection<Identifier> findResources(ResourceType var1, String var2, int var3, Predicate<String> var4) {
System.out.println("called " + var1 + " " + var2 + " " + var3);
Collection<Identifier> 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);

View file

@ -55,16 +55,6 @@ public class ModZipResourcePack extends ZipResourcePack implements ModResourcePa
}
}
@Override
public Collection<Identifier> findResources(ResourceType var1, String var2, int var3, Predicate<String> var4) {
System.out.println("called " + var1 + " " + var2 + " " + var3);
Collection<Identifier> 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);

View file

@ -17,5 +17,5 @@
package net.fabricmc.fabric.tools;
public interface MiningToolDelegate {
float getMiningToolEfficiency();
float getBlockBreakingSpeed();
}