Skip to content

Commit

Permalink
1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexNijjar committed Nov 21, 2023
1 parent 18f0600 commit 1e6e602
Show file tree
Hide file tree
Showing 31 changed files with 156 additions and 147 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
MAVEN_PASS: ${{ secrets.MAVEN_PASSWORD }}

- name: Upload Forge Releases (Curse/Modrinth/Github)
id: forge_release
if: contains(steps.properties.outputs.enabledPlatforms, 'forge')
id: neoforge_release
if: contains(steps.properties.outputs.enabledPlatforms, 'neoforge')
uses: Kir-Antipov/[email protected]
with:
curseforge-id: ${{ vars.CURSE_ID }}
Expand All @@ -48,8 +48,8 @@ jobs:
modrinth-id: ${{ vars.MODRINTH_ID }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

files: ./forge/build/libs/!(*-@(dev|sources|dev-shadow)).jar
name: "[Forge] Cadmus ${{ steps.properties.outputs.version }}"
files: ./neoforge/build/libs/!(*-@(dev|sources|dev-shadow)).jar
name: "[NeoForge] Cadmus ${{ steps.properties.outputs.version }}"
version: ${{ steps.properties.outputs.version }}
version-type: release
changelog-file: changelog.md
Expand Down Expand Up @@ -87,8 +87,8 @@ jobs:
- name: Generate Discord Embed
run: ./gradlew injectEmbed
env:
FORGE_RELEASE_URL: ${{ steps.forge_release.outputs.modrinth-url }}
FABRIC_RELEASE_URL: ${{ steps.fabric_release.outputs.modrinth-url }}
FORGE_RELEASE_URL: ${{ steps.forge_release.outputs.modrinth-version }}
FABRIC_RELEASE_URL: ${{ steps.fabric_release.outputs.modrinth-version }}

- name: Upload Discord Embed
uses: tsickert/[email protected]
Expand Down
11 changes: 5 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
java
id("maven-publish")
id("com.teamresourceful.resourcefulgradle") version "0.0.+"
id("dev.architectury.loom") version "1.2-SNAPSHOT" apply false
id("dev.architectury.loom") version "1.4-SNAPSHOT" apply false
id("architectury-plugin") version "3.4-SNAPSHOT"
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
}
Expand Down Expand Up @@ -38,9 +38,8 @@ subprojects {
}

repositories {
maven(url = "https://maven.architectury.dev/")
maven(url = "https://maven.minecraftforge.net/")
maven(url = "https://maven.resourcefulbees.com/repository/maven-public/")
maven(url = "https://maven.neoforged.net/releases/")
maven {
url = uri("https://jitpack.io")
content {
Expand All @@ -64,7 +63,7 @@ subprojects {

officialMojangMappings()

parchment(create(group = "org.parchmentmc.data", name = "parchment-$minecraftVersion", version = parchmentVersion))
parchment(create(group = "org.parchmentmc.data", name = "parchment-1.20.1", version = parchmentVersion))
})

compileOnly(group = "com.teamresourceful", name = "yabn", version = "1.0.3")
Expand All @@ -82,9 +81,9 @@ subprojects {
implementation(this)
"include"(this)
}
"modLocalRuntime"(group = "earth.terrarium.prometheus", name = "prometheus-$modLoader-1.20", version = prometheusVersion)
// "modLocalRuntime"(group = "earth.terrarium.prometheus", name = "prometheus-$modLoader-1.20", version = prometheusVersion)

"modRuntimeOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-$modLoader", version = reiVersion)
// "modRuntimeOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-$modLoader", version = reiVersion)
"modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-api-$modLoader", version = reiVersion)
"modCompileOnly"(group = "me.shedaniel", name = "RoughlyEnoughItems-default-plugin-$modLoader", version = reiVersion)
}
Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Update to 1.20.2
- Fix chunkloading not being applied when you chunk load your already claimed chunk without first unclaiming it.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package earth.terrarium.cadmus.client.claims;

import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.datafixers.util.Pair;
import com.mojang.math.Axis;
import com.teamresourceful.resourcefullib.client.CloseablePoseStack;
Expand All @@ -20,6 +19,7 @@
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.ImageButton;
import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.client.gui.components.WidgetSprites;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.Component;
Expand All @@ -39,6 +39,14 @@ public class ClaimScreen extends BaseCursorScreen {

public static final int MAP_SIZE = 200;
public static final ResourceLocation CONTAINER_BACKGROUND = new ResourceLocation(Cadmus.MOD_ID, "textures/gui/map.png");
private static final WidgetSprites TRASH_BUTTON_SPRITES = new WidgetSprites(
new ResourceLocation(Cadmus.MOD_ID, "claimmap/trash_button"),
new ResourceLocation(Cadmus.MOD_ID, "claimmap/trash_button_highlighted")
);
private static final WidgetSprites X_BUTTON_SPRITES = new WidgetSprites(
new ResourceLocation(Cadmus.MOD_ID, "claimmap/x_button"),
new ResourceLocation(Cadmus.MOD_ID, "claimmap/x_button_highlighted")
);
public static final ResourceLocation MAP_ICONS = new ResourceLocation("textures/map/map_icons.png");
public static final int ORANGE = 0xfff59a22;
public static final int AQUA = 0xff55ffff;
Expand Down Expand Up @@ -166,8 +174,8 @@ protected void init() {
int x = (this.width - 216) / 2;
int y = (this.height - 237) / 2;

this.addRenderableWidget(new ImageButton(x + 7, y + 6, 11, 11, 216, 0, 11,
CONTAINER_BACKGROUND,
this.addRenderableWidget(new ImageButton(x + 7, y + 6, 11, 11,
TRASH_BUTTON_SPRITES,
button -> {
if (Screen.hasShiftDown()) {
clearAll();
Expand All @@ -178,15 +186,20 @@ protected void init() {
}
)).setTooltip(Tooltip.create(ConstantComponents.CLEAR_CLAIMED_CHUNKS));

this.addRenderableWidget(new ImageButton(x + 216 - 11 - 7, y + 6, 11, 11, 227, 0, 11,
CONTAINER_BACKGROUND,
this.addRenderableWidget(new ImageButton(x + 216 - 11 - 7, y + 6, 11, 11,
X_BUTTON_SPRITES,
button -> this.onClose()
)).setTooltip(Tooltip.create(ConstantComponents.CLOSE));
}

@Override
public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
super.renderBackground(graphics);
super.render(graphics, mouseX, mouseY, partialTick);
}

@Override
public void renderBackground(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
super.renderBackground(graphics, mouseX, mouseY, partialTick);
renderBackgroundTexture(graphics);
if (this.mapRenderer == null) {
graphics.drawCenteredString(font, ConstantComponents.LOADING, (int) (width / 2f), (int) (height / 2f), 0xFFFFFF);
Expand All @@ -201,14 +214,13 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
this.renderPlayerAvatar(player, graphics);
}
}
super.render(graphics, mouseX, mouseY, partialTick);
}

private void renderBackgroundTexture(GuiGraphics graphics) {
graphics.fill((width - MAP_SIZE) / 2, (height - MAP_SIZE) / 2, (width + MAP_SIZE) / 2, (height + MAP_SIZE) / 2, 0xff000000);
int left = (this.width - 216) / 2;
int top = (this.height - 237) / 2 + 1;
RenderSystem.enableBlend();
// RenderSystem.enableBlend();
graphics.blit(CONTAINER_BACKGROUND, left, top, 0, 0, 216, 237);
graphics.drawString(font, ConstantComponents.TITLE, (int) ((this.width - font.width(ConstantComponents.TITLE)) / 2f), top + 7, 0x404040, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void saveData(CompoundTag tag) {
}

public static AdminClaimHandler read(MinecraftServer server) {
return read(server.overworld().getDataStorage(), AdminClaimHandler::new, "cadmus_admin_claims");
return read(server.overworld().getDataStorage(), HandlerType.create(AdminClaimHandler::new), "cadmus_admin_claims");
}

public static void create(MinecraftServer server, String id, Map<String, Flag<?>> claim) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void saveData(CompoundTag tag) {
}

public static CadmusDataHandler read(MinecraftServer server) {
return read(server.overworld().getDataStorage(), CadmusDataHandler::new, "cadmus_data");
return read(server.overworld().getDataStorage(), HandlerType.create(CadmusDataHandler::new), "cadmus_data");
}

public static Map<String, IntIntPair> getMaxTeamClaims(MinecraftServer server) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ public void saveData(CompoundTag tag) {
}

public static ClaimHandler read(ServerLevel level) {
return read(level.getDataStorage(), () -> new ClaimHandler(level.dimension()), "cadmus_claims");
return read(level.getDataStorage(), HandlerType.create(() -> new ClaimHandler(level.dimension())), "cadmus_claims");
}

public static void addClaims(ServerLevel level, String id, Map<ChunkPos, ClaimType> claimData) {
var data = read(level);
// Remove any claims that are already claimed by another team
claimData.keySet().removeAll(data.claims.keySet());
claimData.keySet().removeIf(pos -> data.claims.containsKey(pos) && !data.claims.get(pos).getFirst().equals(id));

data.listenHandler.addClaims(level, id, claimData.keySet());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package earth.terrarium.cadmus.common.network;

import com.teamresourceful.resourcefullib.common.networking.NetworkChannel;
import com.teamresourceful.resourcefullib.common.networking.base.NetworkDirection;
import earth.terrarium.cadmus.Cadmus;
import earth.terrarium.cadmus.common.network.messages.*;
import net.minecraft.network.protocol.PacketFlow;

public class NetworkHandler {
public static final NetworkChannel CHANNEL = new NetworkChannel(Cadmus.MOD_ID, 1, "main", true);

public static void init() {
CHANNEL.registerPacket(NetworkDirection.CLIENT_TO_SERVER, ServerboundRequestClaimedChunksPacket.ID, ServerboundRequestClaimedChunksPacket.HANDLER, ServerboundRequestClaimedChunksPacket.class);
CHANNEL.registerPacket(NetworkDirection.CLIENT_TO_SERVER, ServerboundUpdateClaimedChunksPacket.ID, ServerboundUpdateClaimedChunksPacket.HANDLER, ServerboundUpdateClaimedChunksPacket.class);
CHANNEL.registerPacket(NetworkDirection.CLIENT_TO_SERVER, ServerboundClearChunksPacket.ID, ServerboundClearChunksPacket.HANDLER, ServerboundClearChunksPacket.class);
CHANNEL.registerPacket(NetworkDirection.CLIENT_TO_SERVER, ServerboundListenToChunksPacket.ID, ServerboundListenToChunksPacket.HANDLER, ServerboundListenToChunksPacket.class);
CHANNEL.registerPacket(PacketFlow.SERVERBOUND, ServerboundRequestClaimedChunksPacket.ID, ServerboundRequestClaimedChunksPacket.HANDLER, ServerboundRequestClaimedChunksPacket.class);
CHANNEL.registerPacket(PacketFlow.SERVERBOUND, ServerboundUpdateClaimedChunksPacket.ID, ServerboundUpdateClaimedChunksPacket.HANDLER, ServerboundUpdateClaimedChunksPacket.class);
CHANNEL.registerPacket(PacketFlow.SERVERBOUND, ServerboundClearChunksPacket.ID, ServerboundClearChunksPacket.HANDLER, ServerboundClearChunksPacket.class);
CHANNEL.registerPacket(PacketFlow.SERVERBOUND, ServerboundListenToChunksPacket.ID, ServerboundListenToChunksPacket.HANDLER, ServerboundListenToChunksPacket.class);

CHANNEL.registerPacket(NetworkDirection.SERVER_TO_CLIENT, ClientboundSendClaimedChunksPacket.ID, ClientboundSendClaimedChunksPacket.HANDLER, ClientboundSendClaimedChunksPacket.class);
CHANNEL.registerPacket(NetworkDirection.SERVER_TO_CLIENT, ClientboundUpdateListeningChunksPacket.ID, ClientboundUpdateListeningChunksPacket.HANDLER, ClientboundUpdateListeningChunksPacket.class);
CHANNEL.registerPacket(PacketFlow.CLIENTBOUND, ClientboundSendClaimedChunksPacket.ID, ClientboundSendClaimedChunksPacket.HANDLER, ClientboundSendClaimedChunksPacket.class);
CHANNEL.registerPacket(PacketFlow.CLIENTBOUND, ClientboundUpdateListeningChunksPacket.ID, ClientboundUpdateListeningChunksPacket.HANDLER, ClientboundUpdateListeningChunksPacket.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(ServerLevel.class)
public abstract class ServerLevelMixin {

@WrapWithCondition(method = "tickChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;setBlockAndUpdate(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z", ordinal = 2))
private boolean cadmus$tickChunk(ServerLevel level, BlockPos pos, BlockState state, LevelChunk chunk, int randomTickSpeed) {
@WrapWithCondition(method = "tickIceAndSnow", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;setBlockAndUpdate(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z", ordinal = 2))
private boolean cadmus$tickChunk(ServerLevel level, BlockPos pos, BlockState state) {
return AdminClaimHandler.getBooleanFlag(level, new ChunkPos(pos), ModFlags.SNOW_FALL);
}

@WrapWithCondition(method = "tickChunk", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;setBlockAndUpdate(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z"))
private boolean cadmus$tickChunkIce(ServerLevel level, BlockPos pos, BlockState state, LevelChunk chunk, int randomTickSpeed) {
@WrapWithCondition(method = "tickIceAndSnow", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;setBlockAndUpdate(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z"))
private boolean cadmus$tickChunkIce(ServerLevel level, BlockPos pos, BlockState state) {
return AdminClaimHandler.getBooleanFlag(level, new ChunkPos(pos), ModFlags.ICE_FORM);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"cadmus-common.mixins.json"
],
"depends": {
"fabric": "*",
"minecraft": ">=1.20",
"resourcefullib": ">=2.1.1"
"fabric-api": "*",
"minecraft": ">=1.20.2",
"resourcefullib": ">=2.2.1"
}
}
2 changes: 0 additions & 2 deletions forge/gradle.properties

This file was deleted.

This file was deleted.

12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
org.gradle.jvmargs=-Xmx2G

enabledPlatforms=fabric,forge
enabledPlatforms=fabric,neoforge

version=1.0.3
version=1.1.0
group=earth.terrarium.cadmus

minecraftVersion=1.20.1
minecraftVersion=1.20.2
parchmentVersion=2023.07.02
mixinExtrasVersion=0.2.0-beta.8
mixinExtrasVersion=0.2.1

resourcefulLibVersion=2.1.11
resourcefulLibVersion=2.2.2

prometheusVersion=0.0.0
journeymapVersion=1.20-1.9-fabric-SNAPSHOT
reiVersion=12.0.652
reiVersion=13.0.678
21 changes: 7 additions & 14 deletions forge/build.gradle.kts → neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
architectury {
forge()
}

loom {
forge {
mixinConfig("cadmus-common.mixins.json")
mixinConfig("cadmus.mixins.json")
}
neoForge()
}

val common: Configuration by configurations.creating {
configurations.compileClasspath.get().extendsFrom(this)
configurations.runtimeClasspath.get().extendsFrom(this)
configurations["developmentForge"].extendsFrom(this)
configurations["developmentNeoForge"].extendsFrom(this)
}

dependencies {
val minecraftVersion: String by project
val forgeVersion: String by project
val neoforgeVersion: String by project
val reiVersion: String by project

forge(group = "net.minecraftforge", name = "forge", version = "$minecraftVersion-$forgeVersion")
neoForge(group = "net.neoforged", name = "neoforge", version = neoforgeVersion)

modCompileOnly(group = "me.shedaniel", name = "RoughlyEnoughItems-api-forge", version = reiVersion)
modLocalRuntime(group = "me.shedaniel", name = "RoughlyEnoughItems-forge", version = reiVersion)
// modLocalRuntime(group = "me.shedaniel", name = "RoughlyEnoughItems-neoforge", version = reiVersion)
// modLocalRuntime(group = "dev.architectury", name = "architectury-neoforge", version = "10.0.16")

common(project(":common", configuration = "namedElements")) {
isTransitive = false
}
shadowCommon(project(path = ":common", configuration = "transformProductionForge")) {
shadowCommon(project(path = ":common", configuration = "transformProductionNeoForge")) {
isTransitive = false
}

Expand Down
2 changes: 2 additions & 0 deletions neoforge/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
loom.platform=neoforge
neoforgeVersion=20.2.60-beta
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//package earth.terrarium.cadmus.client.compat.rei.neoforge;
//
//import earth.terrarium.cadmus.client.compat.rei.CadmusReiClientPlugin;
//import me.shedaniel.rei.forge.REIPluginClient;
//
//@REIPluginClient
//public class CadmusReiPluginForge extends CadmusReiClientPlugin {
//}
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
package earth.terrarium.cadmus.client.forge;
package earth.terrarium.cadmus.client.neoforge;

import earth.terrarium.cadmus.client.CadmusClient;
import net.minecraft.client.Minecraft;
import net.minecraft.commands.Commands;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.neoforge.client.event.RegisterClientCommandsEvent;
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.TickEvent;

@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class CadmusClientForge {
public class CadmusClientNeoForge {

@SubscribeEvent
public static void onClientSetup(FMLClientSetupEvent event) {
event.enqueueWork(CadmusClient::init);
MinecraftForge.EVENT_BUS.addListener(CadmusClientForge::onClientTick);
MinecraftForge.EVENT_BUS.addListener(CadmusClientForge::onRegisterClientCommands);
NeoForge.EVENT_BUS.addListener(CadmusClientNeoForge::onClientTick);
NeoForge.EVENT_BUS.addListener(CadmusClientNeoForge::onRegisterClientCommands);

IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
bus.addListener(CadmusClientForge::onRegisterKeyBindings);
bus.addListener(CadmusClientNeoForge::onRegisterKeyBindings);
}

public static void onClientTick(TickEvent.ClientTickEvent event) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package earth.terrarium.cadmus.common.util.forge;
package earth.terrarium.cadmus.common.util.neoforge;

import earth.terrarium.cadmus.api.claims.ClaimApi;
import net.minecraft.world.entity.Entity;
Expand Down
Loading

0 comments on commit 1e6e602

Please sign in to comment.