diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f3f1f2..8398c6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## 89.0.0 + +### Changed + +- Updated to 1.21.2/1.21.3 +- The `/tk clear` command now supports custom input filters as well as optionally being able to remove bedrock from the world + - This technically replaces existing functionality where a tag or blockstate would be read from the input but due to poor auto-complete, this is basically an unknown feature so we've changed it to one that's much more clear + - The new syntax is `/tk clear [filter] [removeBedrock]` + ## 87.0.1 ### Changed @@ -22,7 +31,6 @@ - Updated to 1.21 - ## 85.0.0 ### Changed diff --git a/build.gradle b/build.gradle index 126cff2..9fd9741 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,9 @@ +import groovy.json.JsonSlurper + 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 "dev.architectury.loom" version "1.7-SNAPSHOT" apply false + id "me.modmuss50.mod-publish-plugin" version "0.7.1" } architectury { @@ -88,12 +90,14 @@ publishMods { accessToken = providers.environmentVariable("CURSE_TOKEN") projectId = "${curseforge_id}" minecraftVersions.add("${minecraft_version}") + minecraftVersions.add("1.21.2") } def modrinthOptions = modrinthOptions { accessToken = providers.environmentVariable("MODRINTH_TOKEN") projectId = "${modrinth_id}" minecraftVersions.add("${minecraft_version}") + minecraftVersions.add("1.21.2") } curseforge("curseforgeFabric") { @@ -146,3 +150,46 @@ publishMods { } } } + +tasks.register("updateModVersion") { + doLast { + def gradleFile = file("gradle.properties") + def text = gradleFile.text + + def minecraftVersion = getModPrefixVersion() + def modVersion = text.find("mod_version=(.*)") + + if (modVersion == null) { + throw new IllegalStateException("Could not find mod_version in gradle.properties") + } + + modVersion = modVersion.split("=")[1] + def remainingVersion = modVersion.tokenize(".").drop(1).join(".") + def newVersion = "${minecraftVersion}.${remainingVersion}" + + text = text.replace("mod_version=${modVersion}", "mod_version=${newVersion}") + gradleFile.text = text + + println "Updated mod version to ${newVersion} from ${modVersion}" + } +} + +def getModPrefixVersion() { + def url = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json" + def json = new JsonSlurper().parseText(url.toURL().text) + + def versions = json.versions + versions = versions.reverse() // We want the oldest version first + versions = versions.findAll { it.type == "release" } // We only want releases + + def incrementalVersion = 0 + for (version in versions) { + if (version.id == minecraft_version) { + break + } + + incrementalVersion++ + } + + return incrementalVersion +} diff --git a/common/src/main/java/com/sunekaer/toolkit/commands/TKCommand.java b/common/src/main/java/com/sunekaer/toolkit/commands/TKCommand.java index 1a484eb..07019a5 100644 --- a/common/src/main/java/com/sunekaer/toolkit/commands/TKCommand.java +++ b/common/src/main/java/com/sunekaer/toolkit/commands/TKCommand.java @@ -41,7 +41,7 @@ public static void register(CommandDispatcher dispatcher, Co .then(SlayerCommand.register()) .then(EnchantCommand.register(context)) .then(BlockDistributionCommand.register()) - .then(ClearCommand.register()) + .then(ClearCommand.register(context)) .then(KillEntitiesCommand.register(context)) .then(HealCommand.register()) .then(RepairItemCommand.register()) diff --git a/common/src/main/java/com/sunekaer/toolkit/commands/items/SlayerCommand.java b/common/src/main/java/com/sunekaer/toolkit/commands/items/SlayerCommand.java index aa7a240..562d63e 100644 --- a/common/src/main/java/com/sunekaer/toolkit/commands/items/SlayerCommand.java +++ b/common/src/main/java/com/sunekaer/toolkit/commands/items/SlayerCommand.java @@ -38,8 +38,8 @@ private static int giveItem(ServerPlayer player) { var enchants = itemstack.get(DataComponents.ENCHANTMENTS); var mutableEnchants = new ItemEnchantments.Mutable(enchants); - Registry enchantmentRegistry = player.server.registryAccess().registryOrThrow(Registries.ENCHANTMENT); - enchantments.forEach(e -> mutableEnchants.set(enchantmentRegistry.getHolderOrThrow(e), Short.MAX_VALUE)); + Registry enchantmentRegistry = player.server.registryAccess().lookupOrThrow(Registries.ENCHANTMENT); + enchantments.forEach(e -> mutableEnchants.set(enchantmentRegistry.get(e).orElseThrow(), Short.MAX_VALUE)); itemstack.set(DataComponents.ENCHANTMENTS, mutableEnchants.toImmutable()); boolean added = player.getInventory().add(itemstack.copy()); diff --git a/common/src/main/java/com/sunekaer/toolkit/commands/level/ClearCommand.java b/common/src/main/java/com/sunekaer/toolkit/commands/level/ClearCommand.java index a7882cb..879d44c 100644 --- a/common/src/main/java/com/sunekaer/toolkit/commands/level/ClearCommand.java +++ b/common/src/main/java/com/sunekaer/toolkit/commands/level/ClearCommand.java @@ -1,5 +1,6 @@ package com.sunekaer.toolkit.commands.level; +import com.mojang.brigadier.arguments.BoolArgumentType; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; @@ -7,21 +8,20 @@ import com.sunekaer.toolkit.ToolkitPlatform; import com.sunekaer.toolkit.jobs.ServerTickJobRunner; import com.sunekaer.toolkit.utils.ChunkRangeIterator; +import net.minecraft.commands.CommandBuildContext; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; +import net.minecraft.commands.arguments.blocks.BlockPredicateArgument; import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; -import net.minecraft.tags.TagKey; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.pattern.BlockInWorld; import java.util.*; import java.util.concurrent.ExecutorService; @@ -33,19 +33,57 @@ public class ClearCommand { private static final AtomicBoolean COMPLETED = new AtomicBoolean(true); public static final ExecutorService EXECUTOR = Executors.newSingleThreadExecutor(); - public static ArgumentBuilder register() { + public static ArgumentBuilder register(CommandBuildContext commandBuildContext) { return (Commands.literal("clear") .requires(cs -> cs.hasPermission(2)) - .executes(context -> remove(context.getSource(), 1, RemovalPredicate.NAMES[0])) - .then(Commands.argument("range", IntegerArgumentType.integer()).executes(ctx -> remove(ctx.getSource(), IntegerArgumentType.getInteger(ctx, "range"), RemovalPredicate.NAMES[0])) - .then(Commands.argument("filter", StringArgumentType.string()).suggests((commandContext, suggestionsBuilder) -> SharedSuggestionProvider.suggest(RemovalPredicate.NAMES, suggestionsBuilder)).executes(ctx -> remove(ctx.getSource(), IntegerArgumentType.getInteger(ctx, "range"), StringArgumentType.getString(ctx, "filter")))))); + .executes(context -> remove(context.getSource(), 1, RemovalPredicate.NAMES[0], false)) + .then(Commands.argument("range", IntegerArgumentType.integer()) + .executes(ctx -> remove(ctx.getSource(), IntegerArgumentType.getInteger(ctx, "range"), RemovalPredicate.NAMES[0], false)) + .then(Commands.argument("filter", StringArgumentType.string()) + .suggests((commandContext, suggestionsBuilder) -> SharedSuggestionProvider.suggest(RemovalPredicate.NAMES, suggestionsBuilder)) + .executes(ctx -> remove(ctx.getSource(), IntegerArgumentType.getInteger(ctx, "range"), StringArgumentType.getString(ctx, "filter"), false)) + .then(Commands.argument("removes_bedrock", BoolArgumentType.bool()) + .executes(ctx -> remove(ctx.getSource(), IntegerArgumentType.getInteger(ctx, "range"), StringArgumentType.getString(ctx, "filter"), BoolArgumentType.getBool(ctx, "removes_bedrock"))) + ) + ) + .then(Commands.literal("custom_filter") + .then(Commands.argument("block", BlockPredicateArgument.blockPredicate(commandBuildContext)) + .executes(ctx -> remove(ctx.getSource(), IntegerArgumentType.getInteger(ctx, "range"), BlockPredicateArgument.getBlockPredicate(ctx, "block"))) + ) + ) + ) + ); } - private static int remove(CommandSourceStack source, int size, String filter) throws CommandSyntaxException { + private static int remove(CommandSourceStack source, int size, String filter, boolean removesBedrock) throws CommandSyntaxException { + _remove(new RemoveContext( + source, + size, + RemovalPredicate.getFromName(filter).orElse(RemovalPredicate.JUST_ORES).stateCheck, + removesBedrock + )); + + return 1; + } + + private static int remove(CommandSourceStack source, int size, Predicate blockCheck) throws CommandSyntaxException { + _remove(new RemoveContext( + source, + size, + blockCheck, + false + )); + + return 1; + } + + private static void _remove(RemoveContext context) throws CommandSyntaxException { + var source = context.commandStack; + // Block running if (!COMPLETED.get()) { source.sendFailure(Component.literal("Already running, give it a second.")); - return 1; + return; } COMPLETED.set(false); @@ -53,23 +91,15 @@ private static int remove(CommandSourceStack source, int size, String filter) th // Resolve the predicate check, we're lazy, so we'll get the enum regardless but if the filter looks like a // tag then lets try a tag instead - var removalCheck = RemovalPredicate.getFromName(filter).orElse(RemovalPredicate.JUST_ORES); - Predicate customCheck = null; - if (filter.startsWith("#")) { - customCheck = state -> state.is(TagKey.create(Registries.BLOCK, ResourceLocation.withDefaultNamespace(filter.replace("#", "")))); - } else if(filter.contains(":")) { - customCheck = state -> BuiltInRegistries.BLOCK.getKey(state.getBlock()).toString().equalsIgnoreCase(filter); - } + var removalCheck = context.filter; ServerLevel level = source.getLevel(); source.sendSuccess(() -> Component.translatable("commands.toolkit.remove.lagwarring"), true); // We're removing 1 to make it so 1 = 0, 2 - 1, etc, this means we'll have correct radius 0 = 1x1, 1 = 3x3, 2 = 5x5 - var range = size - 1; + var range = context.size - 1; var chunkPos = player.chunkPosition(); - // Compute the max height for the wall and queue the chunk removal - Predicate finalCustomCheck = customCheck; COMPLETED.set(false); for (int x = chunkPos.x - range; x <= chunkPos.x + range; x++) { @@ -79,7 +109,7 @@ private static int remove(CommandSourceStack source, int size, String filter) th final boolean shouldComplete = x == chunkPos.x + range && z == chunkPos.z + range; ServerTickJobRunner.get().add(() -> { - removeChunk(level, currentChunkPos, finalCustomCheck != null ? finalCustomCheck : removalCheck.stateCheck); + removeChunk(level, currentChunkPos, removalCheck, context.removesBedrock); // If this is the last chunk, then we're done if (shouldComplete) { @@ -88,8 +118,6 @@ private static int remove(CommandSourceStack source, int size, String filter) th }); } } - - return 1; } /** @@ -99,21 +127,20 @@ private static int remove(CommandSourceStack source, int size, String filter) th * @param chunkPos the chunk to remove * @param blockCheck the predicate that defines what blocks are removed */ - private static void removeChunk(ServerLevel level, ChunkPos chunkPos, Predicate blockCheck) { + private static void removeChunk(ServerLevel level, ChunkPos chunkPos, Predicate blockCheck, boolean removeBedrock) { BlockState airState = Blocks.AIR.defaultBlockState(); ChunkRangeIterator iterator = new ChunkRangeIterator(level, chunkPos, 1, true); List updatedBlocks = new ArrayList<>(); - int maxHeight = level.dimension() == ServerLevel.NETHER ? 127 : level.getMaxBuildHeight(); - + int maxHeight = level.dimension() == ServerLevel.NETHER ? 127 : level.getMaxY(); while (iterator.hasNext()) { BlockPos pos = iterator.next(); final BlockState state = level.getBlockState(pos); // Don't remove bedrock and skip air, it's a waste of computation - if (state.isAir() || state.getBlock() == Blocks.BEDROCK) { - if (!state.isAir() && pos.getY() > level.getMinBuildHeight() && pos.getY() < maxHeight) { + if (state.isAir() || (!removeBedrock && state.getBlock() == Blocks.BEDROCK)) { + if (!state.isAir() && pos.getY() > level.getMinY() && pos.getY() < maxHeight) { level.setBlock(pos, airState, Block.UPDATE_CLIENTS); updatedBlocks.add(pos); } @@ -121,7 +148,8 @@ private static void removeChunk(ServerLevel level, ChunkPos chunkPos, Predicate< continue; } - if (blockCheck.test(state)) { + var blockInWorld = new BlockInWorld(level, pos, true); + if (!blockCheck.test(blockInWorld)) { continue; } @@ -135,14 +163,14 @@ private static void removeChunk(ServerLevel level, ChunkPos chunkPos, Predicate< } private enum RemovalPredicate { - JUST_ORES(state -> state.is(ToolkitPlatform.getOresTag())), - ORES_AND_MODDED(state -> state.is(ToolkitPlatform.getOresTag()) && BuiltInRegistries.BLOCK.getKey(state.getBlock()).getNamespace().equals("minecraft")); + JUST_ORES(state -> !state.getState().is(ToolkitPlatform.getOresTag())), + ORES_AND_MODDED(state -> !state.getState().is(ToolkitPlatform.getOresTag()) || !BuiltInRegistries.BLOCK.getKey(state.getState().getBlock()).getNamespace().equals("minecraft")); public static final List VALUES = Arrays.asList(values()); public static final String[] NAMES = VALUES.stream().map(e -> e.toString().toLowerCase()).toArray(String[]::new); - final Predicate stateCheck; - RemovalPredicate(Predicate stateCheck) { + final Predicate stateCheck; + RemovalPredicate(Predicate stateCheck) { this.stateCheck = stateCheck; } @@ -150,5 +178,12 @@ public static Optional getFromName(String name) { return VALUES.stream().filter(e -> e.toString().toLowerCase().equals(name)).findFirst(); } } + + private record RemoveContext( + CommandSourceStack commandStack, + int size, + Predicate filter, + boolean removesBedrock + ) {} } diff --git a/common/src/main/java/com/sunekaer/toolkit/commands/level/KillEntitiesCommand.java b/common/src/main/java/com/sunekaer/toolkit/commands/level/KillEntitiesCommand.java index a29815f..35817e8 100644 --- a/common/src/main/java/com/sunekaer/toolkit/commands/level/KillEntitiesCommand.java +++ b/common/src/main/java/com/sunekaer/toolkit/commands/level/KillEntitiesCommand.java @@ -98,7 +98,7 @@ private static int kill(KillType type, CommandSourceStack source) throws Command if (type == KillType.me || type == KillType.players) { for (Player player : level.getPlayers(e -> type.checker.test(e, e))) { - player.kill(); + player.kill(source.getLevel()); entitiesKilled++; } } else { diff --git a/common/src/main/java/com/sunekaer/toolkit/commands/level/MineAreaCommand.java b/common/src/main/java/com/sunekaer/toolkit/commands/level/MineAreaCommand.java index 4d2848a..076dc3a 100644 --- a/common/src/main/java/com/sunekaer/toolkit/commands/level/MineAreaCommand.java +++ b/common/src/main/java/com/sunekaer/toolkit/commands/level/MineAreaCommand.java @@ -53,9 +53,9 @@ private static int mine(CommandSourceStack source, int size, String filter) thro try { ItemStack breaker = new ItemStack(Items.NETHERITE_PICKAXE); - Registry enchantmentRegistry = source.getLevel().registryAccess().registryOrThrow(Registries.ENCHANTMENT); + Registry enchantmentRegistry = source.getLevel().registryAccess().lookupOrThrow(Registries.ENCHANTMENT); // breaker.enchant(Enchantments.BLOCK_FORTUNE, 3); - breaker.enchant(enchantmentRegistry.getHolderOrThrow(Enchantments.SILK_TOUCH), 1); + breaker.enchant(enchantmentRegistry.get(Enchantments.SILK_TOUCH).orElseThrow(), 1); MinecraftServer server = source.getServer(); ServerLevel level = source.getLevel(); diff --git a/common/src/main/java/com/sunekaer/toolkit/commands/player/TeleportDimensionSpawnCommand.java b/common/src/main/java/com/sunekaer/toolkit/commands/player/TeleportDimensionSpawnCommand.java index ffc0d09..2d9a54f 100644 --- a/common/src/main/java/com/sunekaer/toolkit/commands/player/TeleportDimensionSpawnCommand.java +++ b/common/src/main/java/com/sunekaer/toolkit/commands/player/TeleportDimensionSpawnCommand.java @@ -11,6 +11,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.Relative; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.Heightmap; @@ -45,7 +46,7 @@ private static int teleport(CommandSourceStack source, MinecraftServer server, C if (entity instanceof ServerPlayer serverPlayer) { playerXp = serverPlayer.experienceLevel; - serverPlayer.teleportTo(level, pos.getX(), pos.getY(), pos.getZ(), entity.getYRot(), entity.getXRot()); + serverPlayer.teleportTo(level, pos.getX(), pos.getY(), pos.getZ(), Relative.ALL, entity.getYRot(), entity.getXRot(), true); serverPlayer.setExperienceLevels(playerXp); } else { entity.teleportTo(pos.getX(), pos.getY(), pos.getZ()); diff --git a/common/src/main/java/com/sunekaer/toolkit/utils/ChunkRangeIterator.java b/common/src/main/java/com/sunekaer/toolkit/utils/ChunkRangeIterator.java index b4519eb..523c62a 100644 --- a/common/src/main/java/com/sunekaer/toolkit/utils/ChunkRangeIterator.java +++ b/common/src/main/java/com/sunekaer/toolkit/utils/ChunkRangeIterator.java @@ -42,12 +42,12 @@ public ChunkRangeIterator(Level level, ChunkPos startPos, int size, boolean reve this.currentX = minX; this.currentZ = minZ; this.reverseY = reverseY; - this.currentY = reverseY ? level.getMaxBuildHeight() : level.getMinBuildHeight(); + this.currentY = reverseY ? level.getMaxY() : level.getMinY(); } @Override public boolean hasNext() { - return (this.reverseY ? currentY > level.getMinBuildHeight() : currentY < level.getMaxBuildHeight()) + return (this.reverseY ? currentY >= level.getMinY() : currentY <= level.getMaxY()) && currentZ < maxZ && currentX < maxX; } @@ -70,6 +70,6 @@ public BlockPos next() { } } - return pos; + return pos; } } diff --git a/fabric/build.gradle b/fabric/build.gradle index fef2cba..02ef1e2 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -45,7 +45,7 @@ processResources { filesMatching("fabric.mod.json") { expand "version": project.version, - "mcversion": rootProject.minecraft_version, + "mcversion": rootProject.lowest_minecraft_version, "archversion": rootProject.architectury_version } } @@ -88,4 +88,4 @@ publishing { from components.java } } -} \ No newline at end of file +} diff --git a/forge/build.gradle b/forge/build.gradle deleted file mode 100644 index b0acfd8..0000000 --- a/forge/build.gradle +++ /dev/null @@ -1,92 +0,0 @@ -plugins { - id "com.github.johnrengelman.shadow" version "7.1.2" -} - -architectury { - platformSetupLoomIde() - forge() -} - -def generatedResources = file("src/generated") - -loom { - accessWidenerPath = project(":common").loom.accessWidenerPath - - forge { - convertAccessWideners = true - extraAccessWideners.add loom.accessWidenerPath.get().asFile.name - - mixinConfig "toolkit-common.mixins.json" - mixinConfig "toolkit.mixins.json" - } -} - -sourceSets { - main { - resources.srcDir generatedResources - } -} - -configurations { - common - shadowCommon - compileClasspath.extendsFrom common - runtimeClasspath.extendsFrom common - developmentForge.extendsFrom common -} - -dependencies { - forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" - modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}" - - common(project(path: ":common", configuration: "namedElements")) { transitive false } - shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } -} - -processResources { - inputs.property "version", project.version - - filesMatching("META-INF/mods.toml") { - expand "version": project.version - } -} - -shadowJar { - exclude "fabric.mod.json" - exclude "architectury.common.json" - - configurations = [project.configurations.shadowCommon] - setArchiveClassifier("dev-shadow") -} - -remapJar { - input.set shadowJar.archiveFile - dependsOn shadowJar - setArchiveClassifier(null) - setArchivesBaseName("${rootProject.archives_base_name}-${project.name}") -} - -jar { - setArchiveClassifier("dev") -} - -sourcesJar { - def commonSources = project(":common").sourcesJar - dependsOn commonSources - from commonSources.archiveFile.map { zipTree(it) } -} - -components.java { - withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { - skip() - } -} - -publishing { - publications { - mavenForge(MavenPublication) { - artifactId = "${rootProject.archivesBaseName}-${project.name}" - from components.java - } - } -} \ No newline at end of file diff --git a/forge/gradle.properties b/forge/gradle.properties deleted file mode 100644 index 32f842a..0000000 --- a/forge/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -loom.platform=forge \ No newline at end of file diff --git a/forge/src/main/java/com/sunekaer/toolkit/forge/ToolkitForge.java b/forge/src/main/java/com/sunekaer/toolkit/forge/ToolkitForge.java deleted file mode 100644 index dba8000..0000000 --- a/forge/src/main/java/com/sunekaer/toolkit/forge/ToolkitForge.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sunekaer.toolkit.forge; - -import com.sunekaer.toolkit.commands.level.KillEntitiesCommand; -import dev.architectury.platform.forge.EventBuses; -import com.sunekaer.toolkit.Toolkit; -import net.minecraft.commands.synchronization.ArgumentTypeInfo; -import net.minecraft.commands.synchronization.ArgumentTypeInfos; -import net.minecraft.commands.synchronization.SingletonArgumentInfo; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; - -@Mod(Toolkit.MOD_ID) -public class ToolkitForge { - private static final DeferredRegister> ARGUMENT_REGISTRY = DeferredRegister.create(ForgeRegistries.COMMAND_ARGUMENT_TYPES, Toolkit.MOD_ID); - private static final RegistryObject> KILL_TYPE_ARG = ARGUMENT_REGISTRY.register("kill_type", - () -> ArgumentTypeInfos.registerByClass(KillEntitiesCommand.KillTypeArgument.class, SingletonArgumentInfo.contextFree(KillEntitiesCommand.KillTypeArgument::killType))); - public ToolkitForge() { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - EventBuses.registerModEventBus(Toolkit.MOD_ID, modEventBus); - Toolkit.init(); - - ARGUMENT_REGISTRY.register(modEventBus); - } -} diff --git a/forge/src/main/java/com/sunekaer/toolkit/forge/ToolkitPlatformImpl.java b/forge/src/main/java/com/sunekaer/toolkit/forge/ToolkitPlatformImpl.java deleted file mode 100644 index 3393eba..0000000 --- a/forge/src/main/java/com/sunekaer/toolkit/forge/ToolkitPlatformImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.sunekaer.toolkit.forge; - -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.fml.loading.FMLPaths; -import org.jetbrains.annotations.Nullable; - -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -public class ToolkitPlatformImpl { - public static Path getConfigDirectory() { - return FMLPaths.CONFIGDIR.get(); - } - - public static TagKey getOresTag() { - return Tags.Blocks.ORES; - } - - public static Path getGamePath() { - return FMLPaths.GAMEDIR.get(); - } - - public static List getInventoryFromBlockEntity(Level level, BlockPos pos, @Nullable Direction direction) { - List items = new ArrayList<>(); - - BlockEntity entity = level.getBlockEntity(pos); - if (entity == null) { - return items; - } - - entity.getCapability(ForgeCapabilities.ITEM_HANDLER).ifPresent(handler -> { - for (int i = 0; i < handler.getSlots(); i++) { - var stack = handler.getStackInSlot(i); - if (stack.isEmpty()) { - continue; - } - items.add(stack); - } - }); - - return items; - } -} diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml deleted file mode 100644 index f488643..0000000 --- a/forge/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,33 +0,0 @@ -modLoader = "javafml" -loaderVersion="[49,)" #mandatory -license = "All Rights Reserved" - -[[mods]] -modId = "toolkit" -version = "${version}" -displayName = "Toolkit" -authors="Sunekaer" -description=''' -This mod adds bunch of useful commands -''' - -[[dependencies.toolkit]] -modId = "forge" -mandatory = true -versionRange = "[49,)" -ordering = "NONE" -side = "BOTH" - -[[dependencies.toolkit]] -modId = "minecraft" -mandatory = true -versionRange = "[1.20.4,)" -ordering = "NONE" -side = "BOTH" - -[[dependencies.toolkit]] -modId = "architectury" -mandatory = true -versionRange = "[11.0.11,)" -ordering = "AFTER" -side = "BOTH" diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta deleted file mode 100644 index 00c81ec..0000000 --- a/forge/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "Toolkit mod Mod", - "pack_format": 9 - } -} diff --git a/forge/src/main/resources/toolkit.mixins.json b/forge/src/main/resources/toolkit.mixins.json deleted file mode 100644 index 8ee99e3..0000000 --- a/forge/src/main/resources/toolkit.mixins.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "required": true, - "package": "com.sunekaer.toolkit.mixin.forge", - "compatibilityLevel": "JAVA_17", - "minVersion": "0.8", - "client": [ - ], - "mixins": [ - ], - "injectors": { - "defaultRequire": 1 - } -} diff --git a/gradle.properties b/gradle.properties index f43c266..342086a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,21 +1,19 @@ org.gradle.jvmargs=-Xmx2048M -minecraft_version=1.21 -#enabled_platforms=fabric,forge,neoforge +minecraft_version=1.21.3 +lowest_minecraft_version=1.21.2 enabled_platforms=fabric,neoforge archives_base_name=ToolKit -mod_version=87.0.1 +mod_version=89.0.0 maven_group=com.sunekaer.mods -architectury_version=13.0.3 +architectury_version=14.0.4 -fabric_loader_version=0.15.11 -fabric_api_version=0.100.6+1.21 +fabric_loader_version=0.16.9 +fabric_api_version=0.114.0+1.21.3 -forge_version=51.0.23 - -neoforge_version=21.0.78-beta +neoforge_version=21.3.58 curseforge_id=324888 modrinth_id=fWj0tJp5 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 48c0a02..e1adfb4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists