Skip to content

Commit

Permalink
Update Fabric to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
pop4959 committed Jun 17, 2024
1 parent e93d95a commit 80d0c75
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ repositories {
}

dependencies {
minecraft(group = "com.mojang", name = "minecraft", version = "1.20.5")
mappings(group = "net.fabricmc", name = "yarn", version = "1.20.5+build.1", classifier = "v2")
modImplementation(group = "net.fabricmc", name = "fabric-loader", version = "0.15.10")
modImplementation(group = "net.fabricmc.fabric-api", name = "fabric-api", version = "0.97.6+1.20.5")
minecraft(group = "com.mojang", name = "minecraft", version = "1.21")
mappings(group = "net.fabricmc", name = "yarn", version = "1.21+build.2", classifier = "v2")
modImplementation(group = "net.fabricmc", name = "fabric-loader", version = "0.15.11")
modImplementation(group = "net.fabricmc.fabric-api", name = "fabric-api", version = "0.100.1+1.21")
modImplementation(group = "org.popcraft", name = "chunky-fabric", version = "${project.property("target")}")
compileOnly(group = "us.dynmap", name = "DynmapCoreAPI", version = "${project.property("target_dynmap")}")
compileOnly(group = "com.github.BlueMap-Minecraft", name = "BlueMapAPI", version = "${project.property("target_bluemap")}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
import net.minecraft.server.network.ServerPlayerEntity;

public interface RespawningPlayerBridge {

void chunkyborder$setRespawningPlayer(ServerPlayerEntity player);

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.popcraft.chunkyborder.mixin;

import net.minecraft.entity.Entity;
import net.minecraft.server.PlayerManager;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.TeleportTarget;
import net.minecraft.world.WorldProperties;
import org.popcraft.chunkyborder.bridge.RespawningPlayerBridge;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -12,8 +14,6 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import java.util.Optional;

@Mixin(PlayerManager.class)
public class PlayerManagerMixin {

Expand All @@ -26,7 +26,7 @@ public class PlayerManagerMixin {
),
locals = LocalCapture.CAPTURE_FAILHARD
)
private void handleRespawningPlayerBridge(ServerPlayerEntity player, boolean alive, CallbackInfoReturnable<ServerPlayerEntity> cir, BlockPos blockPos, float f, boolean bl, ServerWorld serverWorld, Optional optional, ServerWorld serverWorld2, ServerPlayerEntity respawningPlayer) {
private void handleRespawningPlayerBridge(ServerPlayerEntity player, boolean alive, Entity.RemovalReason removalReason, CallbackInfoReturnable<ServerPlayerEntity> cir, TeleportTarget target, ServerWorld serverWorld, ServerPlayerEntity respawningPlayer, Vec3d vec3d, byte b, ServerWorld serverWorld2, WorldProperties worldProperties) {
((RespawningPlayerBridge) respawningPlayer.networkHandler).chunkyborder$setRespawningPlayer(respawningPlayer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ private void renderWorldBorder(final Camera camera, final CallbackInfo ci) {
if (borderShape == null) {
return;
}
final BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
final double renderDistanceBlocks = this.client.options.getClampedViewDistance() * 16D;
final double posX = camera.getPos().x;
final double posZ = camera.getPos().z;
Expand Down Expand Up @@ -97,7 +96,7 @@ private void renderWorldBorder(final Camera camera, final CallbackInfo ci) {
RenderSystem.disableCull();
final float offset = (Util.getMeasuringTimeMs() % 3000L) / 3000.0F;
float textureVertical = (float) (height - MathHelper.fractionalPart(camera.getPos().y));
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
final BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
final float textureSize = 0.5F;
if (borderShape instanceof final PolygonBorderShape polygon) {
final double[] pointsX = polygon.getPointsX();
Expand Down Expand Up @@ -223,6 +222,6 @@ private void addWall(final BufferBuilder bufferBuilder, final double height, fin
}

private void addVertex(final BufferBuilder bufferBuilder, final double height, final double x1, final double z1, final double x2, final double z2, final float u, final float v) {
bufferBuilder.vertex(x2 - x1, height, z2 - z1).texture(u, v).next();
bufferBuilder.vertex((float) (x2 - x1), (float) height, (float) (z2 - z1)).texture(u, v);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import io.netty.buffer.ByteBuf;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;
import org.popcraft.chunky.platform.World;
import org.popcraft.chunky.shape.Shape;
import org.popcraft.chunkyborder.util.ClientBorder;
import org.popcraft.chunkyborder.util.PluginMessage;

public class BorderPayload implements CustomPayload {
public static final CustomPayload.Id<BorderPayload> ID = CustomPayload.id("chunky:border");
public static final CustomPayload.Id<BorderPayload> ID = new CustomPayload.Id<>(Identifier.of("chunky:border"));
private World world;
private Shape shape;
private ClientBorder border;
Expand Down
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"chunkyborder.mixins.json"
],
"depends": {
"fabricloader": ">=0.15.10",
"fabricloader": ">=0.15.11",
"fabric": "*",
"minecraft": ">=1.20.5",
"minecraft": ">=1.21",
"java": ">=21",
"chunky": ">=${target}"
},
Expand Down

0 comments on commit 80d0c75

Please sign in to comment.