Skip to content

Commit

Permalink
Update Forge to 1.20.5
Browse files Browse the repository at this point in the history
  • Loading branch information
pop4959 committed May 6, 2024
1 parent abc4173 commit c7771f9
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 19 deletions.
4 changes: 2 additions & 2 deletions forge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ repositories {
}

dependencies {
minecraft(group = "com.mojang", name = "minecraft", version = "1.20.2")
minecraft(group = "com.mojang", name = "minecraft", version = "1.20.6")
mappings(loom.officialMojangMappings())
forge(group = "net.minecraftforge", name = "forge", version = "1.20.2-48.1.0")
forge(group = "net.minecraftforge", name = "forge", version = "1.20.6-50.0.6")
modImplementation(group = "org.popcraft", name = "chunky-forge", 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
@@ -1,10 +1,8 @@
package org.popcraft.chunkyborder;

import io.netty.buffer.ByteBufInputStream;
import io.netty.buffer.Unpooled;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.DustParticleOptions;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
Expand Down Expand Up @@ -34,14 +32,14 @@
import org.popcraft.chunkyborder.command.BorderCommand;
import org.popcraft.chunkyborder.event.border.BorderChangeEvent;
import org.popcraft.chunkyborder.integration.DynmapCommonAPIProvider;
import org.popcraft.chunkyborder.packet.BorderPayload;
import org.popcraft.chunkyborder.platform.Config;
import org.popcraft.chunkyborder.platform.MapIntegrationLoader;
import org.popcraft.chunkyborder.shape.BorderShape;
import org.popcraft.chunkyborder.shape.EllipseBorderShape;
import org.popcraft.chunkyborder.shape.PolygonBorderShape;
import org.popcraft.chunkyborder.util.BorderColor;
import org.popcraft.chunkyborder.util.Particles;
import org.popcraft.chunkyborder.util.PluginMessage;

import java.io.DataInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -166,11 +164,8 @@ public void onServerTick(final TickEvent.ServerTickEvent event) {
}

private void sendBorderPacket(final Collection<ServerPlayer> players, final World world, final Shape shape) {
final FriendlyByteBuf data = new FriendlyByteBuf(Unpooled.buffer())
.writeResourceLocation(PLAY_BORDER_PACKET_ID)
.writeBytes(PluginMessage.writeBorder(world, shape));
for (final ServerPlayer player : players) {
player.connection.send(new ClientboundCustomPayloadPacket(data));
player.connection.send(new ClientboundCustomPayloadPacket(new BorderPayload(world, shape)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.BufferUploader;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.minecraft.Util;
Expand Down Expand Up @@ -45,7 +44,7 @@ public class LevelRendererMixin {
@Inject(method = "renderWorldBorder", at = @At("HEAD"), cancellable = true)
@SuppressWarnings("java:S3776")
private void renderWorldBorder(final Camera camera, final CallbackInfo ci) {
final BorderShape borderShape = ChunkyBorderForge.getBorderShape(this.level.dimensionTypeId().location());
final BorderShape borderShape = ChunkyBorderForge.getBorderShape(this.level.dimension().location());
if (borderShape == null) {
return;
}
Expand Down Expand Up @@ -87,9 +86,6 @@ private void renderWorldBorder(final Camera camera, final CallbackInfo ci) {
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderSystem.setShaderTexture(0, FORCEFIELD_LOCATION);
RenderSystem.depthMask(Minecraft.useShaderTransparency());
PoseStack poseStack = RenderSystem.getModelViewStack();
poseStack.pushPose();
RenderSystem.applyModelViewMatrix();
final int color = BorderColor.getColor();
final float red = (color >> 16 & 255) / 255.0F;
final float green = (color >> 8 & 255) / 255.0F;
Expand Down Expand Up @@ -207,8 +203,6 @@ private void renderWorldBorder(final Camera camera, final CallbackInfo ci) {
RenderSystem.disablePolygonOffset();
RenderSystem.disableBlend();
RenderSystem.defaultBlendFunc();
poseStack.popPose();
RenderSystem.applyModelViewMatrix();
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.depthMask(true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.popcraft.chunkyborder.packet;

import io.netty.buffer.ByteBuf;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import org.jetbrains.annotations.NotNull;
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 CustomPacketPayload {
public static final Type<BorderPayload> ID = CustomPacketPayload.createType("chunky:border");
private World world;
private Shape shape;
private ClientBorder border;

public BorderPayload(final World world, final Shape shape) {
this.world = world;
this.shape = shape;
}

public BorderPayload(final FriendlyByteBuf buf) {
final ByteBuf unwrapped = buf.unwrap();
final byte[] bytes = new byte[unwrapped.readableBytes()];
unwrapped.readBytes(bytes);
this.border = PluginMessage.readBorder(bytes);
}

public void write(final FriendlyByteBuf buf) {
buf.writeBytes(PluginMessage.writeBorder(world, shape));
}

public ClientBorder getBorder() {
return border;
}

@Override
public @NotNull Type<BorderPayload> type() {
return ID;
}
}
4 changes: 2 additions & 2 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ description="${description}"
[[dependencies.chunkyborder]]
modId="forge"
mandatory=true
versionRange="[46,)"
versionRange="[50,)"
ordering="NONE"
side="BOTH"
[[dependencies.chunkyborder]]
modId="minecraft"
mandatory=true
versionRange="[1.20.2,1.21)"
versionRange="[1.20.5,1.21)"
ordering="NONE"
side="BOTH"
[[dependencies.chunkyborder]]
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G
group=org.popcraft
artifactName=ChunkyBorder
version=1.2
target=1.4.7
target=1.4.10
target_dynmap=3.3
target_bluemap=v2.1.0
target_squaremap=1.1.2
Expand Down

0 comments on commit c7771f9

Please sign in to comment.