diff --git a/build.gradle b/build.gradle index bba03fe..8932513 100755 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false - id "me.modmuss50.mod-publish-plugin" version "0.4.5" + id "me.modmuss50.mod-publish-plugin" version "0.5.1" } architectury { @@ -117,8 +117,8 @@ publishMods { } def fabricOptions = createOptions("fabric") -// def forgeOptions = createOptions("forge") def neoForgeOptions = createOptions("neoforge") +// def forgeOptions = createOptions("forge") def curseForgeOptions = curseforgeOptions { accessToken = providers.environmentVariable("CURSEFORGE_KEY") @@ -128,10 +128,18 @@ publishMods { curseforge("curseforgeFabric") { from(curseForgeOptions, fabricOptions) projectId = curseforge_id_fabric - requires {slug = "fabric-api" } - requires {slug = "architectury-api" } - requires {slug = 'ftb-library-fabric' } - optional {slug = 'ftb-ranks-fabric' } + requires("fabric-api") + requires("architectury-api") + requires('ftb-library-fabric') + optional('ftb-ranks-fabric') + } + + curseforge("curseforgeNeoForge") { + from(curseForgeOptions, neoForgeOptions) + projectId = curseforge_id_forge + requires("architectury-api") + requires('ftb-library-forge') + optional('ftb-ranks-forge') } // curseforge("curseforgeForge") { @@ -141,12 +149,4 @@ publishMods { // requires {slug = 'ftb-library-forge' } // optional {slug = 'ftb-ranks-forge' } // } - - curseforge("curseforgeNeoForge") { - from(curseForgeOptions, neoForgeOptions) - projectId = curseforge_id_forge - requires {slug = "architectury-api" } - requires {slug = 'ftb-library-forge' } - optional {slug = 'ftb-ranks-forge' } - } } diff --git a/common/build.gradle b/common/build.gradle index 833efbf..d571ea1 100755 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,6 +1,6 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - modApi "dev.architectury:architectury:${rootProject.architectury_version}" + modApi "dev.architectury:architectury:${rootProject.architectury_api_version}" modApi "dev.ftb.mods:ftb-library:${rootProject.ftb_library_version}" modApi "dev.ftb.mods:ftb-ranks:${rootProject.ftb_ranks_version}" } diff --git a/common/src/main/java/dev/ftb/mods/ftbultimine/BrokenItemHandler.java b/common/src/main/java/dev/ftb/mods/ftbultimine/BrokenItemHandler.java deleted file mode 100755 index e3aa235..0000000 --- a/common/src/main/java/dev/ftb/mods/ftbultimine/BrokenItemHandler.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.ftb.mods.ftbultimine; - -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.EquipmentSlot; - -import java.util.function.Consumer; - -public class BrokenItemHandler implements Runnable { - private final ServerPlayer player; - public boolean isBroken = false; - - public BrokenItemHandler(ServerPlayer player) { - this.player = player; - } - - @Override - public void run() { - isBroken = true; - player.broadcastBreakEvent(EquipmentSlot.MAINHAND); - } -} \ No newline at end of file diff --git a/common/src/main/java/dev/ftb/mods/ftbultimine/FTBUltimine.java b/common/src/main/java/dev/ftb/mods/ftbultimine/FTBUltimine.java index a0eec6e..7c86dd8 100755 --- a/common/src/main/java/dev/ftb/mods/ftbultimine/FTBUltimine.java +++ b/common/src/main/java/dev/ftb/mods/ftbultimine/FTBUltimine.java @@ -67,14 +67,14 @@ public class FTBUltimine { private int tempBlockDroppedXp; private ItemCollection tempBlockDropsList; - public static final TagKey DENY_TAG = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "excluded_tools")); - public static final TagKey STRICT_DENY_TAG = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "excluded_tools/strict")); - public static final TagKey ALLOW_TAG = TagKey.create(Registries.ITEM, new ResourceLocation(MOD_ID, "included_tools")); + public static final TagKey DENY_TAG = TagKey.create(Registries.ITEM, FTBUltimine.rl("excluded_tools")); + public static final TagKey STRICT_DENY_TAG = TagKey.create(Registries.ITEM, FTBUltimine.rl("excluded_tools/strict")); + public static final TagKey ALLOW_TAG = TagKey.create(Registries.ITEM, FTBUltimine.rl("included_tools")); - public static final TagKey EXCLUDED_BLOCKS = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "excluded_blocks")); - public static final TagKey BLOCK_WHITELIST = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "block_whitelist")); - public static final TagKey TILLABLE_TAG = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "farmland_tillable")); - public static final TagKey FLATTENABLE_TAG = TagKey.create(Registries.BLOCK, new ResourceLocation(MOD_ID, "shovel_flattenable")); + public static final TagKey EXCLUDED_BLOCKS = TagKey.create(Registries.BLOCK, FTBUltimine.rl("excluded_blocks")); + public static final TagKey BLOCK_WHITELIST = TagKey.create(Registries.BLOCK, FTBUltimine.rl("block_whitelist")); + public static final TagKey TILLABLE_TAG = TagKey.create(Registries.BLOCK, FTBUltimine.rl("farmland_tillable")); + public static final TagKey FLATTENABLE_TAG = TagKey.create(Registries.BLOCK, FTBUltimine.rl("shovel_flattenable")); private static Predicate permissionOverride = player -> true; @@ -358,7 +358,7 @@ public EventResult entityJoinedWorld(Entity entity, Level level) { } public static ResourceLocation rl(String path) { - return new ResourceLocation(MOD_ID, path); + return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); } public static boolean isTooExhausted(ServerPlayer player) { diff --git a/common/src/main/java/dev/ftb/mods/ftbultimine/RightClickHandlers.java b/common/src/main/java/dev/ftb/mods/ftbultimine/RightClickHandlers.java index acd8114..9683e92 100644 --- a/common/src/main/java/dev/ftb/mods/ftbultimine/RightClickHandlers.java +++ b/common/src/main/java/dev/ftb/mods/ftbultimine/RightClickHandlers.java @@ -13,6 +13,7 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.HoneycombItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -29,7 +30,6 @@ public class RightClickHandlers { static int axeStripping(ServerPlayer player, InteractionHand hand, BlockPos clickPos, FTBUltiminePlayerData data) { Set sounds = new HashSet<>(); - BrokenItemHandler brokenItemHandler = new BrokenItemHandler(player); Level level = player.level(); ItemStack itemStack = player.getItemInHand(hand); @@ -59,9 +59,9 @@ static int axeStripping(ServerPlayer player, InteractionHand hand, BlockPos clic CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, pos, itemStack); level.setBlock(pos, actual.get(), Block.UPDATE_ALL_IMMEDIATE); level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(player, actual.get())); - itemStack.hurtAndBreak(1, level.random, player, brokenItemHandler); - if (brokenItemHandler.isBroken) { + var result = hurtItemAndCheckIfBroken(player, hand); + if (result) { break; } } @@ -72,7 +72,6 @@ static int axeStripping(ServerPlayer player, InteractionHand hand, BlockPos clic static int shovelFlattening(ServerPlayer player, InteractionHand hand, BlockPos clickPos, FTBUltiminePlayerData data) { int didWork = 0; - BrokenItemHandler brokenItemHandler = new BrokenItemHandler(player); for (BlockPos pos : data.cachedPositions()) { if (!player.level().getBlockState(pos.above()).isAir()) { @@ -88,9 +87,10 @@ static int shovelFlattening(ServerPlayer player, InteractionHand hand, BlockPos player.level().setBlock(pos, newState, Block.UPDATE_ALL_IMMEDIATE); didWork++; - player.getMainHandItem().hurtAndBreak(1, player.getRandom(), player, brokenItemHandler); + var result = hurtItemAndCheckIfBroken(player, hand); player.level().gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(player, newState)); - if (brokenItemHandler.isBroken || player.getFoodData().getFoodLevel() <= 0) { + + if (result || player.getFoodData().getFoodLevel() <= 0) { break; } } @@ -105,9 +105,14 @@ static int shovelFlattening(ServerPlayer player, InteractionHand hand, BlockPos return didWork; } + static boolean hurtItemAndCheckIfBroken(ServerPlayer player, InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); + itemStack.hurtAndBreak(1, player, hand == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND); + return itemStack.isEmpty(); + } + static int farmlandConversion(ServerPlayer player, InteractionHand hand, BlockPos clickPos, FTBUltiminePlayerData data) { int clicked = 0; - BrokenItemHandler brokenItemHandler = new BrokenItemHandler(player); for (BlockPos pos : data.cachedPositions()) { if (!player.level().getBlockState(pos.above()).isAir()) { @@ -121,8 +126,9 @@ static int farmlandConversion(ServerPlayer player, InteractionHand hand, BlockPo if (!player.isCreative()) { player.causeFoodExhaustion((float) (FTBUltimineServerConfig.EXHAUSTION_PER_BLOCK.get() * 0.005D)); - player.getMainHandItem().hurtAndBreak(1, player.getRandom(), player, brokenItemHandler); - if (brokenItemHandler.isBroken || FTBUltimine.isTooExhausted(player)) { + var result = hurtItemAndCheckIfBroken(player, hand); + + if (result || FTBUltimine.isTooExhausted(player)) { break; } } diff --git a/common/src/main/java/dev/ftb/mods/ftbultimine/client/EdgeCallback.java b/common/src/main/java/dev/ftb/mods/ftbultimine/client/EdgeCallback.java index 8e5f812..84c5eb7 100755 --- a/common/src/main/java/dev/ftb/mods/ftbultimine/client/EdgeCallback.java +++ b/common/src/main/java/dev/ftb/mods/ftbultimine/client/EdgeCallback.java @@ -20,7 +20,7 @@ public EdgeCallback(BufferBuilder b, Matrix4f m, BlockPos p, int a) { @Override public void consume(double x1, double y1, double z1, double x2, double y2, double z2) { - buffer.vertex(matrix, (float) (x1 + pos.getX()), (float) (y1 + pos.getY()), (float) (z1 + pos.getZ())).color(255, 255, 255, alpha).endVertex(); - buffer.vertex(matrix, (float) (x2 + pos.getX()), (float) (y2 + pos.getY()), (float) (z2 + pos.getZ())).color(255, 255, 255, alpha).endVertex(); + buffer.addVertex(matrix, (float) (x1 + pos.getX()), (float) (y1 + pos.getY()), (float) (z1 + pos.getZ())).setColor(255, 255, 255, alpha); + buffer.addVertex(matrix, (float) (x2 + pos.getX()), (float) (y2 + pos.getY()), (float) (z2 + pos.getZ())).setColor(255, 255, 255, alpha); } -} \ No newline at end of file +} diff --git a/common/src/main/java/dev/ftb/mods/ftbultimine/client/FTBUltimineClient.java b/common/src/main/java/dev/ftb/mods/ftbultimine/client/FTBUltimineClient.java index 70b79de..6e7e24d 100755 --- a/common/src/main/java/dev/ftb/mods/ftbultimine/client/FTBUltimineClient.java +++ b/common/src/main/java/dev/ftb/mods/ftbultimine/client/FTBUltimineClient.java @@ -25,6 +25,7 @@ import dev.ftb.mods.ftbultimine.utils.ShapeMerger; import net.minecraft.ChatFormatting; import net.minecraft.client.Camera; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; @@ -123,8 +124,8 @@ public void renderInGame(PoseStack stack) { VertexConsumer buffer = mc.renderBuffers().bufferSource().getBuffer(UltimineRenderTypes.LINES_NORMAL); for (CachedEdge edge : cachedEdges) { - buffer.vertex(matrix, edge.x1, edge.y1, edge.z1).color(255, 255, 255, 255).endVertex(); - buffer.vertex(matrix, edge.x2, edge.y2, edge.z2).color(255, 255, 255, 255).endVertex(); + buffer.addVertex(matrix, edge.x1, edge.y1, edge.z1).setColor(255, 255, 255, 255); + buffer.addVertex(matrix, edge.x2, edge.y2, edge.z2).setColor(255, 255, 255, 255); } mc.renderBuffers().bufferSource().endBatch(UltimineRenderTypes.LINES_NORMAL); @@ -132,8 +133,8 @@ public void renderInGame(PoseStack stack) { VertexConsumer buffer2 = mc.renderBuffers().bufferSource().getBuffer(UltimineRenderTypes.LINES_TRANSPARENT); for (CachedEdge edge : cachedEdges) { - buffer2.vertex(matrix, edge.x1, edge.y1, edge.z1).color(255, 255, 255, 30).endVertex(); - buffer2.vertex(matrix, edge.x2, edge.y2, edge.z2).color(255, 255, 255, 30).endVertex(); + buffer2.addVertex(matrix, edge.x1, edge.y1, edge.z1).setColor(255, 255, 255, 30); + buffer2.addVertex(matrix, edge.x2, edge.y2, edge.z2).setColor(255, 255, 255, 30); } mc.renderBuffers().bufferSource().endBatch(UltimineRenderTypes.LINES_TRANSPARENT); @@ -243,7 +244,7 @@ public void info(RenderGameOverlayEvent.Text event) } }*/ - public void renderGameOverlay(GuiGraphics graphics, float tickDelta) { + public void renderGameOverlay(GuiGraphics graphics, DeltaTracker tickDelta) { if (pressed) { RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); diff --git a/fabric/build.gradle b/fabric/build.gradle index 94295b2..818cd35 100755 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -28,7 +28,7 @@ dependencies { modApi "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" - modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}" + modApi "dev.architectury:architectury-fabric:${rootProject.architectury_api_version}" modApi("dev.ftb.mods:ftb-library-fabric:${rootProject.ftb_library_version}") { transitive = false } modApi("dev.ftb.mods:ftb-ranks-fabric:${rootProject.ftb_ranks_version}") { transitive = false } @@ -45,9 +45,7 @@ processResources { filesMatching("fabric.mod.json") { expand "version": project.version, - "archversion": project.architectury_version, - "forgeversion": project.forge_version, - "forgeshortversion": project.forge_version.split("\\.")[0], + "archversion": project.architectury_api_version, "mcversion": project.minecraft_version, "ftblibraryversion": project.ftb_library_version } diff --git a/forge/build.gradle b/forge/build.gradle index c1b4554..f2bf3ec 100755 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -31,7 +31,7 @@ artifacts { dependencies { forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" - modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}" + modApi "dev.architectury:architectury-forge:${rootProject.architectury_api_version}" modApi("dev.ftb.mods:ftb-library-forge:${rootProject.ftb_library_version}") { transitive = false } modApi("dev.ftb.mods:ftb-ranks-forge:${rootProject.ftb_ranks_version}") { transitive = false } @@ -49,7 +49,7 @@ processResources { filesMatching("META-INF/mods.toml") { expand "version": project.version, - "archversion": project.architectury_version, + "archversion": project.architectury_api_version, "forgeversion": project.forge_version, "forgeshortversion": project.forge_version.split("\\.")[0], "mcversion": project.minecraft_version, diff --git a/gradle.properties b/gradle.properties index c5125a6..990877b 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,24 +1,26 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -mod_version=2006.1.0 maven_group=dev.ftb.mods mod_id=ftbultimine archives_base_name=ftb-ultimine readable_name=FTB Ultimine mod_author=FTB Team -minecraft_version=1.20.6 +mod_version=2100.1.0 +minecraft_version=1.21 -forge_version=50.0.9 -neoforge_version=20.6.100-beta -neoforge_loader_version=1 -fabric_loader_version=0.15.10 -fabric_api_version=0.99.0+1.20.6 -architectury_version=12.1.3 +#forge_version=50.0.9 +neoforge_version=21.0.10-beta -ftb_library_version=2006.1.1 -ftb_ranks_version=2006.1.0 +# https://maven.neoforged.net/#/releases/net/neoforged/fancymodloader/loader +neoforge_loader_version=4 +fabric_loader_version=0.15.11 +fabric_api_version=0.100.1+1.21 +architectury_api_version=13.0.1 + +ftb_library_version=2100.1.0-SNAPSHOT +ftb_ranks_version=2100.1.0-SNAPSHOT curseforge_id_forge=386134 curseforge_id_fabric=448231 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4518132..6e968fa 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 7abbe7e..d9446b4 100755 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -28,7 +28,7 @@ repositories { dependencies { neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" - modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_version}" + modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_api_version}" modApi("dev.ftb.mods:ftb-library-neoforge:${rootProject.ftb_library_version}") { transitive = false } modApi("dev.ftb.mods:ftb-ranks-neoforge:${rootProject.ftb_ranks_version}") { transitive = false } @@ -44,7 +44,7 @@ processResources { filesMatching("META-INF/neoforge.mods.toml") { expand "version": project.version, - "archversion": project.architectury_version, + "archversion": project.architectury_api_version, "neoforgeversion": project.neoforge_version, "neoforgeloaderversion": project.neoforge_loader_version, "mcversion": project.minecraft_version, diff --git a/settings.gradle b/settings.gradle index a1c4bcf..433cba2 100755 --- a/settings.gradle +++ b/settings.gradle @@ -12,4 +12,4 @@ pluginManagement { include "common", "fabric", /*"forge",*/ "neoforge" -rootProject.name = 'FTB-Ultimine-1.20.6' +rootProject.name = 'FTB-Ultimine-1.21'