Skip to content

Commit

Permalink
Updated to 1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
Haven-King committed May 18, 2020
1 parent 0080414 commit f62e316
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 50 deletions.
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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}"
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
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
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
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class BlockTracker implements CopyableComponent {
public final Chunk chunk;

private HashMap<Integer, LongSet> trackedBlocks = new HashMap<>();
private final HashMap<Integer, LongSet> trackedBlocks = new HashMap<>();
private int version = -1;

public BlockTracker(Chunk chunk) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<WorldChunk> 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()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<T> implements Fibber {
@Shadow private Block block;

@Override
public void fix(ServerPlayerEntity player) {
this.block = FibLib.Blocks.get(block.getDefaultState(), player).getBlock();
}
}
//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<T> implements Fibber {
// @Shadow private Block block;
//
// @Override
// public void fix(ServerPlayerEntity player) {
// this.block = FibLib.Blocks.get(block.getDefaultState(), player).getBlock();
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -20,12 +20,12 @@ public ArrayPaletteFibber(IdList<T> 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<T> 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<T> idList, T object) {
return idList.getId((T) FibLib.Blocks.get((BlockState) object, this.player));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> implements Fibber {
@Shadow @Final private IdList<T> 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<T> 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<T> idList, T object) {
return idList.getId((T) FibLib.Blocks.get((BlockState) object, this.player));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
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;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(IdListPalette.class)
public class IdListPaletteFibber<T> 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<T> idList, T object) {
return idList.getId((T) FibLib.Blocks.get((BlockState) object, this.player));
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@

"depends": {
"fabricloader": ">=0.7.4",
"fabric": "*",
"minecraft": "1.15.x"
"fabric": "*"
},
"custom": {
"modmenu:api": true
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/fiblib.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"blocks.ServerChunkManagerMixin",
"blocks.ServerPlayerEntityMixin",
"blocks.ServerWorldMixin",
"blocks.packets.BlockActionFibber",
"blocks.packets.BlockUpdateFibber",
"blocks.packets.PlayerActionFibber",
"blocks.packets.chunkdata.ArrayPaletteFibber",
Expand Down

0 comments on commit f62e316

Please sign in to comment.