diff --git a/build.gradle b/build.gradle index 2ca3584..7ac8821 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,10 @@ repositories { name = "Onyx Studios" url = "https://maven.onyxstudios.dev" } + maven { + name = "JitPack" + url = uri("https://jitpack.io") + } maven { name = "Ladysnake Libs" url = 'https://dl.bintray.com/ladysnake/libs' @@ -24,7 +28,7 @@ repositories { dependencies { //to change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + mappings "net.fabricmc:yarn:${project.yarn_mappings}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "com.github.NerdHubMC.Cardinal-Components-API:cardinal-components-base:${project.cardinal_version}" diff --git a/gradle.properties b/gradle.properties index 58fcdae..49bb8ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,9 +2,9 @@ org.gradle.jvmargs=-Xmx4G # Fabric Properties -minecraft_version=1.15.2 -yarn_mappings=1.15.2+build.15 -loader_version=0.8.2+build.194 +minecraft_version=20w20b +yarn_mappings=20w20b+build.7:v2 +loader_version=0.8.3+build.196 # Mod Properties mod_version = 0.1.2 @@ -12,6 +12,6 @@ maven_group = dev.hephaestus archives_base_name = FibLib # Dependencies -fabric_version=0.10.1+build.307-1.15 -cardinal_version = 2.3.0 +fabric_version = 0.10.9+build.346-1.16 +cardinal_version = 2.4.0-nightly.20w10a pal_version = 1.1.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4a6ebce..b9d5e5c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Sun May 17 17:40:47 PDT 2020 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-bin.zip -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/dev/hephaestus/fiblib/blocks/BlockTracker.java b/src/main/java/dev/hephaestus/fiblib/blocks/BlockTracker.java index 12b12e4..f6f80db 100644 --- a/src/main/java/dev/hephaestus/fiblib/blocks/BlockTracker.java +++ b/src/main/java/dev/hephaestus/fiblib/blocks/BlockTracker.java @@ -22,7 +22,7 @@ public class BlockTracker implements CopyableComponent { public final Chunk chunk; - private HashMap trackedBlocks = new HashMap<>(); + private final HashMap trackedBlocks = new HashMap<>(); private int version = -1; public BlockTracker(Chunk chunk) { diff --git a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/PacketFibber.java b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/PacketFibber.java index 0a81a13..a7d37d4 100644 --- a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/PacketFibber.java +++ b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/PacketFibber.java @@ -22,7 +22,7 @@ public abstract class PacketFibber { @Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true) public void fixPackets(Packet packet, CallbackInfo ci) { - if (packet instanceof BlockActionS2CPacket || packet instanceof PlayerActionResponseS2CPacket || packet instanceof BlockUpdateS2CPacket || packet instanceof ChunkDeltaUpdateS2CPacket) { + if (/*packet instanceof BlockActionS2CPacket ||*/ packet instanceof PlayerActionResponseS2CPacket || packet instanceof BlockUpdateS2CPacket || packet instanceof ChunkDeltaUpdateS2CPacket) { Fibber.fix(packet, player); this.sendPacket(packet, null); ci.cancel(); diff --git a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/ServerChunkManagerMixin.java b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/ServerChunkManagerMixin.java index e248eae..3725cf3 100644 --- a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/ServerChunkManagerMixin.java +++ b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/ServerChunkManagerMixin.java @@ -2,11 +2,9 @@ import dev.hephaestus.fiblib.FibLib; import dev.hephaestus.fiblib.blocks.BlockTracker; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import net.minecraft.entity.EntityCategory; import net.minecraft.server.world.ChunkHolder; import net.minecraft.server.world.ServerChunkManager; -import net.minecraft.util.math.BlockPos; +import net.minecraft.world.SpawnHelper; import net.minecraft.world.chunk.WorldChunk; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -18,8 +16,8 @@ @Mixin(ServerChunkManager.class) public class ServerChunkManagerMixin { @SuppressWarnings("UnresolvedMixinReference") - @Inject(method = "method_20801(JZ[Lnet/minecraft/entity/EntityCategory;ZILit/unimi/dsi/fastutil/objects/Object2IntMap;Lnet/minecraft/util/math/BlockPos;ILnet/minecraft/server/world/ChunkHolder;)V", at = @At(value = "HEAD")) - public void doThing(long l, boolean z0, EntityCategory [] e, boolean z1, int i0, Object2IntMap o0, BlockPos p0, int i1, ChunkHolder c0, CallbackInfo ci) { + @Inject(remap=false, method = "method_20801(JZLnet/minecraft/world/SpawnHelper$Info;ZILnet/minecraft/server/world/ChunkHolder;Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V", at = @At(value = "HEAD")) + public void doThing(long l, boolean b1, SpawnHelper.Info info, boolean b2, int i, ChunkHolder c0, CallbackInfo ci) { Optional optional = c0.getTickingFuture().getNow(ChunkHolder.UNLOADED_WORLD_CHUNK).left(); BlockTracker tracker; if (optional.isPresent() && (tracker = FibLib.Blocks.TRACKER.get(optional.get())).getVersion() != FibLib.Blocks.getVersion()) { diff --git a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/BlockActionFibber.java b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/BlockActionFibber.java index 97abce6..06ee4cf 100644 --- a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/BlockActionFibber.java +++ b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/BlockActionFibber.java @@ -1,20 +1,20 @@ -package dev.hephaestus.fiblib.mixin.blocks.packets; - -import dev.hephaestus.fiblib.FibLib; -import dev.hephaestus.fiblib.Fibber; -import net.minecraft.block.Block; -import net.minecraft.network.packet.s2c.play.BlockActionS2CPacket; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.math.BlockPos; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -@Mixin(BlockActionS2CPacket.class) -public class BlockActionFibber implements Fibber { - @Shadow private Block block; - - @Override - public void fix(ServerPlayerEntity player) { - this.block = FibLib.Blocks.get(block.getDefaultState(), player).getBlock(); - } -} \ No newline at end of file +//package dev.hephaestus.fiblib.mixin.blocks.packets; +// +//import dev.hephaestus.fiblib.FibLib; +//import dev.hephaestus.fiblib.Fibber; +//import net.minecraft.block.Block; +//import net.minecraft.network.packet.s2c.play.BlockActionS2CPacket; +//import net.minecraft.server.network.ServerPlayerEntity; +//import net.minecraft.util.math.BlockPos; +//import org.spongepowered.asm.mixin.Mixin; +//import org.spongepowered.asm.mixin.Shadow; +// +//@Mixin(BlockActionS2CPacket.class) +//public class BlockActionFibber implements Fibber { +// @Shadow private Block block; +// +// @Override +// public void fix(ServerPlayerEntity player) { +// this.block = FibLib.Blocks.get(block.getDefaultState(), player).getBlock(); +// } +//} \ No newline at end of file diff --git a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/ArrayPaletteFibber.java b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/ArrayPaletteFibber.java index d1a4df5..1eaa275 100644 --- a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/ArrayPaletteFibber.java +++ b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/ArrayPaletteFibber.java @@ -4,7 +4,7 @@ import dev.hephaestus.fiblib.Fibber; import net.minecraft.block.BlockState; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.IdList; +import net.minecraft.util.collection.IdList; import net.minecraft.world.chunk.ArrayPalette; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -20,12 +20,12 @@ public ArrayPaletteFibber(IdList idList) { this.idList = idList; } - @Redirect(method = "toPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/IdList;getId(Ljava/lang/Object;)I")) + @Redirect(method = "toPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/collection/IdList;getId(Ljava/lang/Object;)I")) public int toPacketRedir(IdList idList, T object) { return idList.getId((T) FibLib.Blocks.get((BlockState) object, this.player)); } - @Redirect(method = "getPacketSize", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/IdList;getId(Ljava/lang/Object;)I")) + @Redirect(method = "getPacketSize", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/collection/IdList;getId(Ljava/lang/Object;)I")) public int getPacketSizeRedir(IdList idList, T object) { return idList.getId((T) FibLib.Blocks.get((BlockState) object, this.player)); } diff --git a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/BiMapPaletteFibber.java b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/BiMapPaletteFibber.java index 1bc9803..7301df6 100644 --- a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/BiMapPaletteFibber.java +++ b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/BiMapPaletteFibber.java @@ -4,24 +4,21 @@ import dev.hephaestus.fiblib.Fibber; import net.minecraft.block.BlockState; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.IdList; +import net.minecraft.util.collection.IdList; import net.minecraft.world.chunk.BiMapPalette; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; @Mixin(BiMapPalette.class) public class BiMapPaletteFibber implements Fibber { - @Shadow @Final private IdList idList; ServerPlayerEntity player; - @Redirect(method = "toPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/IdList;getId(Ljava/lang/Object;)I")) + @Redirect(method = "toPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/collection/IdList;getId(Ljava/lang/Object;)I")) public int toPacketRedir(IdList idList, T object) { return idList.getId((T) FibLib.Blocks.get((BlockState) object, this.player)); } - @Redirect(method = "getPacketSize", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/IdList;getId(Ljava/lang/Object;)I")) + @Redirect(method = "getPacketSize", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/collection/IdList;getId(Ljava/lang/Object;)I")) public int packetSizeRedir(IdList idList, T object) { return idList.getId((T) FibLib.Blocks.get((BlockState) object, this.player)); } diff --git a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/ChunkDataS2CPacketFibber.java b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/ChunkDataS2CPacketFibber.java index 1d15244..65cffe4 100644 --- a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/ChunkDataS2CPacketFibber.java +++ b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/ChunkDataS2CPacketFibber.java @@ -7,9 +7,9 @@ import net.minecraft.block.entity.BlockEntity; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.LongArrayTag; +import net.minecraft.network.PacketByteBuf; import net.minecraft.network.packet.s2c.play.ChunkDataS2CPacket; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.PacketByteBuf; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.Heightmap; diff --git a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/IdListPaletteFibber.java b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/IdListPaletteFibber.java index 944cd16..07b53dd 100644 --- a/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/IdListPaletteFibber.java +++ b/src/main/java/dev/hephaestus/fiblib/mixin/blocks/packets/chunkdata/IdListPaletteFibber.java @@ -4,7 +4,7 @@ import dev.hephaestus.fiblib.Fibber; import net.minecraft.block.BlockState; import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.IdList; +import net.minecraft.util.collection.IdList; import net.minecraft.world.chunk.IdListPalette; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -12,7 +12,7 @@ @Mixin(IdListPalette.class) public class IdListPaletteFibber implements Fibber { - @Redirect(method = "getIndex", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/IdList;getId(Ljava/lang/Object;)I")) + @Redirect(method = "getIndex", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/collection/IdList;getId(Ljava/lang/Object;)I")) public int getIndexRedir(IdList idList, T object) { return idList.getId((T) FibLib.Blocks.get((BlockState) object, this.player)); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 03fa999..391bd8d 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -27,8 +27,7 @@ "depends": { "fabricloader": ">=0.7.4", - "fabric": "*", - "minecraft": "1.15.x" + "fabric": "*" }, "custom": { "modmenu:api": true diff --git a/src/main/resources/fiblib.mixins.json b/src/main/resources/fiblib.mixins.json index d537724..34d8956 100644 --- a/src/main/resources/fiblib.mixins.json +++ b/src/main/resources/fiblib.mixins.json @@ -9,7 +9,6 @@ "blocks.ServerChunkManagerMixin", "blocks.ServerPlayerEntityMixin", "blocks.ServerWorldMixin", - "blocks.packets.BlockActionFibber", "blocks.packets.BlockUpdateFibber", "blocks.packets.PlayerActionFibber", "blocks.packets.chunkdata.ArrayPaletteFibber",